mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-07 06:09:42 +00:00
fix #846. ability to limit transit bandwidth
This commit is contained in:
@@ -17,8 +17,8 @@ namespace i2p
|
||||
|
||||
RouterContext::RouterContext ():
|
||||
m_LastUpdateTime (0), m_AcceptsTunnels (true), m_IsFloodfill (false),
|
||||
m_StartupTime (0), m_Status (eRouterStatusOK), m_Error (eRouterErrorNone),
|
||||
m_NetID (I2PD_NET_ID)
|
||||
m_StartupTime (0), m_ShareRatio (100), m_Status (eRouterStatusOK),
|
||||
m_Error (eRouterErrorNone), m_NetID (I2PD_NET_ID)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -246,6 +246,13 @@ namespace i2p
|
||||
else { SetBandwidth('K'); }
|
||||
}
|
||||
|
||||
void RouterContext::SetShareRatio (int percents)
|
||||
{
|
||||
if (percents < 0) percents = 0;
|
||||
if (percents > 100) percents = 100;
|
||||
m_ShareRatio = percents;
|
||||
}
|
||||
|
||||
bool RouterContext::IsUnreachable () const
|
||||
{
|
||||
return m_RouterInfo.GetCaps () & i2p::data::RouterInfo::eUnreachable;
|
||||
|
||||
Reference in New Issue
Block a user