mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
publish congestion cap G
This commit is contained in:
parent
b42be2b391
commit
b8032e7fbf
@ -1090,6 +1090,8 @@ namespace i2p
|
||||
UpdateSSU2Keys ();
|
||||
updated = true;
|
||||
}
|
||||
if (m_RouterInfo.UpdateCongestion (i2p::data::RouterInfo::eLowCongestion))
|
||||
updated = true;
|
||||
if (updated)
|
||||
UpdateRouterInfo ();
|
||||
|
||||
@ -1398,7 +1400,12 @@ namespace i2p
|
||||
{
|
||||
if (ecode != boost::asio::error::operation_aborted)
|
||||
{
|
||||
if (m_RouterInfo.SetHighCongestion (IsHighCongestion ()))
|
||||
auto c = i2p::data::RouterInfo::eLowCongestion;
|
||||
if (!AcceptsTunnels ())
|
||||
c = i2p::data::RouterInfo::eRejectAll;
|
||||
else if (IsHighCongestion ())
|
||||
c = i2p::data::RouterInfo::eHighCongestion;
|
||||
if (m_RouterInfo.UpdateCongestion (c))
|
||||
UpdateRouterInfo ();
|
||||
ScheduleCongestionUpdate ();
|
||||
}
|
||||
|
@ -1077,12 +1077,6 @@ namespace data
|
||||
if (m_Congestion == eHighCongestion)
|
||||
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)
|
||||
@ -1153,9 +1147,8 @@ namespace data
|
||||
SetProperty ("caps", caps);
|
||||
}
|
||||
|
||||
bool LocalRouterInfo::SetHighCongestion (bool highCongestion)
|
||||
bool LocalRouterInfo::UpdateCongestion (Congestion c)
|
||||
{
|
||||
Congestion c = highCongestion ? eHighCongestion : eLowCongestion;
|
||||
if (c != GetCongestion ())
|
||||
{
|
||||
SetCongestion (c);
|
||||
|
@ -330,10 +330,9 @@ namespace data
|
||||
public:
|
||||
|
||||
LocalRouterInfo () = default;
|
||||
LocalRouterInfo (const std::string& fullPath);
|
||||
void CreateBuffer (const PrivateKeys& privateKeys);
|
||||
void UpdateCaps (uint8_t caps);
|
||||
bool SetHighCongestion (bool highCongestion); // returns true if updated
|
||||
bool UpdateCongestion (Congestion c); // returns true if updated
|
||||
|
||||
void SetProperty (const std::string& key, const std::string& value) override;
|
||||
void DeleteProperty (const std::string& key);
|
||||
|
Loading…
Reference in New Issue
Block a user