Merge pull request #1833 from TomasGlgg/feature

Использование скользящего среднего для рассчета tunnel creation success rate
This commit is contained in:
orignal 2023-01-11 15:36:37 -05:00 committed by GitHub
commit f172f44f32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 12 deletions

View file

@ -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();
}
}
}