mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-02 02:44:15 +00:00
fixed warning
This commit is contained in:
parent
e9f0ed6473
commit
f7101cc260
@ -332,8 +332,9 @@ namespace tunnel
|
|||||||
Tunnels tunnels;
|
Tunnels tunnels;
|
||||||
|
|
||||||
Tunnels::Tunnels (): m_IsRunning (false), m_Thread (nullptr),
|
Tunnels::Tunnels (): m_IsRunning (false), m_Thread (nullptr),
|
||||||
m_TunnelCreationSuccessRate (TCSR_START_VALUE), m_TunnelCreationAttemptsNum(0),
|
m_TotalNumSuccesiveTunnelCreations (0), m_TotalNumFailedTunnelCreations (0), // for normal avarage
|
||||||
m_TotalNumSuccesiveTunnelCreations (0), m_TotalNumFailedTunnelCreations (0) { // for normal avarage
|
m_TunnelCreationSuccessRate (TCSR_START_VALUE), m_TunnelCreationAttemptsNum(0)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Tunnels::~Tunnels ()
|
Tunnels::~Tunnels ()
|
||||||
|
@ -253,6 +253,24 @@ namespace tunnel
|
|||||||
std::shared_ptr<ZeroHopsInboundTunnel> CreateZeroHopsInboundTunnel (std::shared_ptr<TunnelPool> pool);
|
std::shared_ptr<ZeroHopsInboundTunnel> CreateZeroHopsInboundTunnel (std::shared_ptr<TunnelPool> pool);
|
||||||
std::shared_ptr<ZeroHopsOutboundTunnel> CreateZeroHopsOutboundTunnel (std::shared_ptr<TunnelPool> pool);
|
std::shared_ptr<ZeroHopsOutboundTunnel> CreateZeroHopsOutboundTunnel (std::shared_ptr<TunnelPool> pool);
|
||||||
|
|
||||||
|
// Calculating of tunnel creation success rate
|
||||||
|
void SuccesiveTunnelCreation()
|
||||||
|
{
|
||||||
|
// total TCSR
|
||||||
|
m_TotalNumSuccesiveTunnelCreations++;
|
||||||
|
// A modified version of the EWMA algorithm, where alpha is increased at the beginning to accelerate similarity
|
||||||
|
double alpha = TCSR_SMOOTHING_CONSTANT + (1 - TCSR_SMOOTHING_CONSTANT)/++m_TunnelCreationAttemptsNum;
|
||||||
|
m_TunnelCreationSuccessRate = alpha * 1 + (1 - alpha) * m_TunnelCreationSuccessRate;
|
||||||
|
|
||||||
|
}
|
||||||
|
void FailedTunnelCreation()
|
||||||
|
{
|
||||||
|
m_TotalNumFailedTunnelCreations++;
|
||||||
|
|
||||||
|
double alpha = TCSR_SMOOTHING_CONSTANT + (1 - TCSR_SMOOTHING_CONSTANT)/++m_TunnelCreationAttemptsNum;
|
||||||
|
m_TunnelCreationSuccessRate = alpha * 0 + (1 - alpha) * m_TunnelCreationSuccessRate;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
bool m_IsRunning;
|
bool m_IsRunning;
|
||||||
@ -270,23 +288,7 @@ namespace tunnel
|
|||||||
i2p::util::MemoryPoolMt<I2NPMessageBuffer<I2NP_TUNNEL_ENPOINT_MESSAGE_SIZE> > m_I2NPTunnelEndpointMessagesMemoryPool;
|
i2p::util::MemoryPoolMt<I2NPMessageBuffer<I2NP_TUNNEL_ENPOINT_MESSAGE_SIZE> > m_I2NPTunnelEndpointMessagesMemoryPool;
|
||||||
i2p::util::MemoryPoolMt<I2NPMessageBuffer<I2NP_TUNNEL_MESSAGE_SIZE> > m_I2NPTunnelMessagesMemoryPool;
|
i2p::util::MemoryPoolMt<I2NPMessageBuffer<I2NP_TUNNEL_MESSAGE_SIZE> > m_I2NPTunnelMessagesMemoryPool;
|
||||||
// count of tunnels for total TCSR algorithm
|
// count of tunnels for total TCSR algorithm
|
||||||
int m_TotalNumSuccesiveTunnelCreations, m_TotalNumFailedTunnelCreations;
|
int m_TotalNumSuccesiveTunnelCreations, m_TotalNumFailedTunnelCreations;
|
||||||
|
|
||||||
// Calculating of tunnel creation success rate
|
|
||||||
void SuccesiveTunnelCreation() {
|
|
||||||
// total TCSR
|
|
||||||
m_TotalNumSuccesiveTunnelCreations++;
|
|
||||||
// A modified version of the EWMA algorithm, where alpha is increased at the beginning to accelerate similarity
|
|
||||||
double alpha = TCSR_SMOOTHING_CONSTANT + (1 - TCSR_SMOOTHING_CONSTANT)/++m_TunnelCreationAttemptsNum;
|
|
||||||
m_TunnelCreationSuccessRate = alpha * 1 + (1 - alpha) * m_TunnelCreationSuccessRate;
|
|
||||||
|
|
||||||
};
|
|
||||||
void FailedTunnelCreation() {
|
|
||||||
m_TotalNumFailedTunnelCreations++;
|
|
||||||
|
|
||||||
double alpha = TCSR_SMOOTHING_CONSTANT + (1 - TCSR_SMOOTHING_CONSTANT)/++m_TunnelCreationAttemptsNum;
|
|
||||||
m_TunnelCreationSuccessRate = alpha * 0 + (1 - alpha) * m_TunnelCreationSuccessRate;
|
|
||||||
};
|
|
||||||
double m_TunnelCreationSuccessRate;
|
double m_TunnelCreationSuccessRate;
|
||||||
int m_TunnelCreationAttemptsNum;
|
int m_TunnelCreationAttemptsNum;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user