mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-05-20 22:31:47 +02:00
publish high congestion cap
This commit is contained in:
parent
24a14e3440
commit
716926f0d7
5 changed files with 63 additions and 14 deletions
libi2pd
|
@ -1071,9 +1071,15 @@ namespace data
|
|||
if (m_Congestion == eLowCongestion || m_Congestion == eMediumCongestion) return false;
|
||||
if (m_Congestion == eRejectAll) return true;
|
||||
if (m_Congestion == eHighCongestion)
|
||||
return (i2p::util::GetMillisecondsSinceEpoch () < m_Timestamp + HIGH_CONGESION_INTERVAL*1000LL) ? true : false;
|
||||
return (i2p::util::GetMillisecondsSinceEpoch () < m_Timestamp + HIGH_CONGESTION_INTERVAL*1000LL) ? true : false;
|
||||
return false;
|
||||
}
|
||||
|
||||
LocalRouterInfo::LocalRouterInfo (const std::string& fullPath):
|
||||
RouterInfo (fullPath)
|
||||
{
|
||||
SetHighCongestion (false); // drop congestion
|
||||
}
|
||||
|
||||
void LocalRouterInfo::CreateBuffer (const PrivateKeys& privateKeys)
|
||||
{
|
||||
|
@ -1143,6 +1149,16 @@ namespace data
|
|||
SetProperty ("caps", caps);
|
||||
}
|
||||
|
||||
void LocalRouterInfo::SetHighCongestion (bool highCongestion)
|
||||
{
|
||||
Congestion c = highCongestion ? eHighCongestion : eLowCongestion;
|
||||
if (c != GetCongestion ())
|
||||
{
|
||||
SetCongestion (c);
|
||||
UpdateCapsProperty ();
|
||||
}
|
||||
}
|
||||
|
||||
void LocalRouterInfo::WriteToStream (std::ostream& s) const
|
||||
{
|
||||
auto addresses = GetAddresses ();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue