MCPcopy Create free account
hub / github.com/PurpleI2P/i2pd / SetFloodfill

Method SetFloodfill

libi2pd/RouterContext.cpp:643–676  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

641 }
642
643 void RouterContext::SetFloodfill (bool floodfill)
644 {
645 if (m_IsFloodfill != floodfill)
646 {
647 m_IsFloodfill = floodfill;
648 auto addresses = m_RouterInfo.GetAddresses ();
649 if (floodfill)
650 {
651 m_RouterInfo.UpdateFloodfillProperty (true);
652 if (addresses)
653 {
654 // disable introducer for all floodfill's SSU2 addresses
655 UpdateSSU2AddressCapsIntroducer ((*addresses)[i2p::data::RouterInfo::eSSU2V4Idx], false);
656 UpdateSSU2AddressCapsIntroducer ((*addresses)[i2p::data::RouterInfo::eSSU2V6Idx], false);
657 }
658 }
659 else
660 {
661 m_RouterInfo.UpdateFloodfillProperty (false);
662 // we don't publish number of routers and leaseset for non-floodfill
663 m_RouterInfo.DeleteProperty (i2p::data::ROUTER_INFO_PROPERTY_LEASESETS);
664 m_RouterInfo.DeleteProperty (i2p::data::ROUTER_INFO_PROPERTY_ROUTERS);
665 if (addresses)
666 {
667 // enable introducers for published non-floodfill's SSU2 addresses
668 auto addr = (*addresses)[i2p::data::RouterInfo::eSSU2V4Idx];
669 if (addr && addr->published) UpdateSSU2AddressCapsIntroducer (addr, true);
670 addr = (*addresses)[i2p::data::RouterInfo::eSSU2V6Idx];
671 if (addr && addr->published) UpdateSSU2AddressCapsIntroducer (addr, true);
672 }
673 }
674 UpdateRouterInfo ();
675 }
676 }
677
678 std::string RouterContext::GetFamily () const
679 {

Callers 2

initMethod · 0.45
SetUnreachableMethod · 0.45

Calls 3

GetAddressesMethod · 0.80
DeletePropertyMethod · 0.80

Tested by

no test coverage detected