mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
Merge pull request #1833 from TomasGlgg/feature
Использование скользящего среднего для рассчета tunnel creation success rate
This commit is contained in:
commit
f172f44f32
2 changed files with 21 additions and 12 deletions
|
@ -332,8 +332,7 @@ namespace tunnel
|
|||
Tunnels tunnels;
|
||||
|
||||
Tunnels::Tunnels (): m_IsRunning (false), m_Thread (nullptr),
|
||||
m_NumSuccesiveTunnelCreations (0), m_NumFailedTunnelCreations (0)
|
||||
{
|
||||
m_TunnelCreationSuccessRate (TCSR_START_VALUE), m_TunnelCreationAttemptsNum(0) {
|
||||
}
|
||||
|
||||
Tunnels::~Tunnels ()
|
||||
|
@ -634,7 +633,7 @@ namespace tunnel
|
|||
}
|
||||
// delete
|
||||
it = pendingTunnels.erase (it);
|
||||
m_NumFailedTunnelCreations++;
|
||||
FailedTunnelCreation();
|
||||
}
|
||||
else
|
||||
++it;
|
||||
|
@ -642,7 +641,7 @@ namespace tunnel
|
|||
case eTunnelStateBuildFailed:
|
||||
LogPrint (eLogDebug, "Tunnel: Pending build request ", it->first, " failed, deleted");
|
||||
it = pendingTunnels.erase (it);
|
||||
m_NumFailedTunnelCreations++;
|
||||
FailedTunnelCreation();
|
||||
break;
|
||||
case eTunnelStateBuildReplyReceived:
|
||||
// intermediate state, will be either established of build failed
|
||||
|
@ -651,7 +650,7 @@ namespace tunnel
|
|||
default:
|
||||
// success
|
||||
it = pendingTunnels.erase (it);
|
||||
m_NumSuccesiveTunnelCreations++;
|
||||
SuccesiveTunnelCreation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue