|
|
|
@ -253,6 +253,24 @@ namespace tunnel
@@ -253,6 +253,24 @@ namespace tunnel
|
|
|
|
|
std::shared_ptr<ZeroHopsInboundTunnel> CreateZeroHopsInboundTunnel (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: |
|
|
|
|
|
|
|
|
|
bool m_IsRunning; |
|
|
|
@ -271,22 +289,6 @@ namespace tunnel
@@ -271,22 +289,6 @@ namespace tunnel
|
|
|
|
|
i2p::util::MemoryPoolMt<I2NPMessageBuffer<I2NP_TUNNEL_MESSAGE_SIZE> > m_I2NPTunnelMessagesMemoryPool; |
|
|
|
|
// count of tunnels for total TCSR algorithm
|
|
|
|
|
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; |
|
|
|
|
int m_TunnelCreationAttemptsNum; |
|
|
|
|
|
|
|
|
|