Skip to content

Commit

Permalink
moved m_Properties to LocalRouterInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
orignal committed Jan 15, 2022
1 parent 338b17c commit a2de556
Show file tree
Hide file tree
Showing 5 changed files with 297 additions and 294 deletions.
1 change: 0 additions & 1 deletion libi2pd/NetDb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,6 @@ namespace data
if (r->GetRouterIdentity () && !r->IsUnreachable () && r->HasValidAddresses ())
{
r->DeleteBuffer ();
r->ClearProperties (); // properties are not used for regular routers
if (m_RouterInfos.emplace (r->GetIdentHash (), r).second)
{
if (r->IsFloodfill () && r->IsEligibleFloodfill ())
Expand Down
12 changes: 6 additions & 6 deletions libi2pd/RouterContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ namespace i2p

if (addressCaps)
routerInfo.SetUnreachableAddressesTransportCaps (addressCaps);
routerInfo.SetCaps (caps); // caps + L
routerInfo.UpdateCaps (caps); // caps + L
routerInfo.SetProperty ("netId", std::to_string (m_NetID));
routerInfo.SetProperty ("router.version", I2P_VERSION);
routerInfo.CreateBuffer (m_Keys);
Expand Down Expand Up @@ -349,10 +349,10 @@ namespace i2p
{
m_IsFloodfill = floodfill;
if (floodfill)
m_RouterInfo.SetCaps (m_RouterInfo.GetCaps () | i2p::data::RouterInfo::eFloodfill);
m_RouterInfo.UpdateCaps (m_RouterInfo.GetCaps () | i2p::data::RouterInfo::eFloodfill);
else
{
m_RouterInfo.SetCaps (m_RouterInfo.GetCaps () & ~i2p::data::RouterInfo::eFloodfill);
m_RouterInfo.UpdateCaps (m_RouterInfo.GetCaps () & ~i2p::data::RouterInfo::eFloodfill);
// we don't publish number of routers and leaseset for non-floodfill
m_RouterInfo.DeleteProperty (i2p::data::ROUTER_INFO_PROPERTY_LEASESETS);
m_RouterInfo.DeleteProperty (i2p::data::ROUTER_INFO_PROPERTY_ROUTERS);
Expand Down Expand Up @@ -414,7 +414,7 @@ namespace i2p
// no break here, extra + high means 'X'
case high : caps |= i2p::data::RouterInfo::eHighBandwidth; break;
}
m_RouterInfo.SetCaps (caps);
m_RouterInfo.UpdateCaps (caps);
UpdateRouterInfo ();
m_BandwidthLimit = limit;
}
Expand Down Expand Up @@ -469,7 +469,7 @@ namespace i2p
caps |= i2p::data::RouterInfo::eUnreachable;
if (v6 || !SupportsV6 ())
caps &= ~i2p::data::RouterInfo::eFloodfill; // can't be floodfill
m_RouterInfo.SetCaps (caps);
m_RouterInfo.UpdateCaps (caps);
}
uint16_t port = 0;
// delete previous introducers
Expand Down Expand Up @@ -501,7 +501,7 @@ namespace i2p
caps |= i2p::data::RouterInfo::eReachable;
if (m_IsFloodfill)
caps |= i2p::data::RouterInfo::eFloodfill;
m_RouterInfo.SetCaps (caps);
m_RouterInfo.UpdateCaps (caps);
}
uint16_t port = 0;
// delete previous introducers
Expand Down
2 changes: 1 addition & 1 deletion libi2pd/RouterContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ namespace garlic
void Init ();

const i2p::data::PrivateKeys& GetPrivateKeys () const { return m_Keys; };
i2p::data::RouterInfo& GetRouterInfo () { return m_RouterInfo; };
i2p::data::LocalRouterInfo& GetRouterInfo () { return m_RouterInfo; };
std::shared_ptr<i2p::data::RouterInfo> GetSharedRouterInfo ()
{
return std::shared_ptr<i2p::data::RouterInfo> (&m_RouterInfo,
Expand Down
Loading

0 comments on commit a2de556

Please sign in to comment.