1
0
mirror of https://github.com/PurpleI2P/i2pd.git synced 2025-01-12 06:07:54 +00:00

update RouterInfo if congestion cap changed

This commit is contained in:
orignal 2023-03-07 13:09:07 -05:00
parent 6d7f20961f
commit 46e4f4aea5
3 changed files with 6 additions and 3 deletions

View File

@ -1397,7 +1397,8 @@ namespace i2p
{ {
if (ecode != boost::asio::error::operation_aborted) if (ecode != boost::asio::error::operation_aborted)
{ {
m_RouterInfo.SetHighCongestion (IsHighCongestion ()); if (m_RouterInfo.SetHighCongestion (IsHighCongestion ()))
UpdateRouterInfo ();
ScheduleCongestionUpdate (); ScheduleCongestionUpdate ();
} }
} }

View File

@ -1149,14 +1149,16 @@ namespace data
SetProperty ("caps", caps); SetProperty ("caps", caps);
} }
void LocalRouterInfo::SetHighCongestion (bool highCongestion) bool LocalRouterInfo::SetHighCongestion (bool highCongestion)
{ {
Congestion c = highCongestion ? eHighCongestion : eLowCongestion; Congestion c = highCongestion ? eHighCongestion : eLowCongestion;
if (c != GetCongestion ()) if (c != GetCongestion ())
{ {
SetCongestion (c); SetCongestion (c);
UpdateCapsProperty (); UpdateCapsProperty ();
return true;
} }
return false;
} }
void LocalRouterInfo::WriteToStream (std::ostream& s) const void LocalRouterInfo::WriteToStream (std::ostream& s) const

View File

@ -332,7 +332,7 @@ namespace data
LocalRouterInfo (const std::string& fullPath); LocalRouterInfo (const std::string& fullPath);
void CreateBuffer (const PrivateKeys& privateKeys); void CreateBuffer (const PrivateKeys& privateKeys);
void UpdateCaps (uint8_t caps); void UpdateCaps (uint8_t caps);
void SetHighCongestion (bool highCongestion); bool SetHighCongestion (bool highCongestion); // returns true if updated
void SetProperty (const std::string& key, const std::string& value) override; void SetProperty (const std::string& key, const std::string& value) override;
void DeleteProperty (const std::string& key); void DeleteProperty (const std::string& key);