Browse Source

update RouterInfo if congestion cap changed

pull/1904/head
orignal 2 years ago
parent
commit
46e4f4aea5
  1. 3
      libi2pd/RouterContext.cpp
  2. 4
      libi2pd/RouterInfo.cpp
  3. 2
      libi2pd/RouterInfo.h

3
libi2pd/RouterContext.cpp

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

4
libi2pd/RouterInfo.cpp

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

2
libi2pd/RouterInfo.h

@ -332,7 +332,7 @@ namespace data @@ -332,7 +332,7 @@ namespace data
LocalRouterInfo (const std::string& fullPath);
void CreateBuffer (const PrivateKeys& privateKeys);
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 DeleteProperty (const std::string& key);

Loading…
Cancel
Save