Browse Source

don't change router status from ipv6

pull/1645/head
orignal 4 years ago
parent
commit
2b0d18a6d7
  1. 32
      libi2pd/RouterContext.cpp

32
libi2pd/RouterContext.cpp

@ -458,12 +458,15 @@ namespace i2p
void RouterContext::SetUnreachable (bool v4, bool v6) void RouterContext::SetUnreachable (bool v4, bool v6)
{ {
// set caps if (v4)
uint8_t caps = m_RouterInfo.GetCaps (); {
caps &= ~i2p::data::RouterInfo::eReachable; // set caps
caps |= i2p::data::RouterInfo::eUnreachable; uint8_t caps = m_RouterInfo.GetCaps ();
caps &= ~i2p::data::RouterInfo::eFloodfill; // can't be floodfill caps &= ~i2p::data::RouterInfo::eReachable;
m_RouterInfo.SetCaps (caps); caps |= i2p::data::RouterInfo::eUnreachable;
caps &= ~i2p::data::RouterInfo::eFloodfill; // can't be floodfill
m_RouterInfo.SetCaps (caps);
}
uint16_t port = 0; uint16_t port = 0;
// delete previous introducers // delete previous introducers
auto& addresses = m_RouterInfo.GetAddresses (); auto& addresses = m_RouterInfo.GetAddresses ();
@ -485,13 +488,16 @@ namespace i2p
void RouterContext::SetReachable (bool v4, bool v6) void RouterContext::SetReachable (bool v4, bool v6)
{ {
// update caps if (v4)
uint8_t caps = m_RouterInfo.GetCaps (); {
caps &= ~i2p::data::RouterInfo::eUnreachable; // update caps
caps |= i2p::data::RouterInfo::eReachable; uint8_t caps = m_RouterInfo.GetCaps ();
if (m_IsFloodfill) caps &= ~i2p::data::RouterInfo::eUnreachable;
caps |= i2p::data::RouterInfo::eFloodfill; caps |= i2p::data::RouterInfo::eReachable;
m_RouterInfo.SetCaps (caps); if (m_IsFloodfill)
caps |= i2p::data::RouterInfo::eFloodfill;
m_RouterInfo.SetCaps (caps);
}
uint16_t port = 0; uint16_t port = 0;
// delete previous introducers // delete previous introducers
auto& addresses = m_RouterInfo.GetAddresses (); auto& addresses = m_RouterInfo.GetAddresses ();

Loading…
Cancel
Save