diff --git a/libi2pd/NetDb.cpp b/libi2pd/NetDb.cpp index 80029ece..a71bb891 100644 --- a/libi2pd/NetDb.cpp +++ b/libi2pd/NetDb.cpp @@ -1168,12 +1168,12 @@ namespace data }); } - std::shared_ptr NetDb::GetRandomIntroducer () const + std::shared_ptr NetDb::GetRandomIntroducer (bool v4) const { return GetRandomRouter ( - [](std::shared_ptr router)->bool + [v4](std::shared_ptr router)->bool { - return router->IsIntroducer (true) && !router->IsHidden () && !router->IsFloodfill (); // floodfills don't send relay tag + return router->IsIntroducer (v4) && !router->IsHidden () && !router->IsFloodfill (); // floodfills don't send relay tag }); } diff --git a/libi2pd/NetDb.hpp b/libi2pd/NetDb.hpp index b782872c..244ff39b 100644 --- a/libi2pd/NetDb.hpp +++ b/libi2pd/NetDb.hpp @@ -87,7 +87,7 @@ namespace data std::shared_ptr GetHighBandwidthRandomRouter (std::shared_ptr compatibleWith, bool reverse) const; std::shared_ptr GetRandomPeerTestRouter (bool v4, const std::set& excluded) const; std::shared_ptr GetRandomSSUV6Router () const; // TODO: change to v6 peer test later - std::shared_ptr GetRandomIntroducer () const; + std::shared_ptr GetRandomIntroducer (bool v4) const; std::shared_ptr GetClosestFloodfill (const IdentHash& destination, const std::set& excluded, bool closeThanUsOnly = false) const; std::vector GetClosestFloodfills (const IdentHash& destination, size_t num, std::set& excluded, bool closeThanUsOnly = false) const; diff --git a/libi2pd/SSU.cpp b/libi2pd/SSU.cpp index 5ffcf890..b0ad1710 100644 --- a/libi2pd/SSU.cpp +++ b/libi2pd/SSU.cpp @@ -794,10 +794,10 @@ namespace transport std::set > requested; for (auto i = introducers.size (); i < SSU_MAX_NUM_INTRODUCERS; i++) { - auto introducer = i2p::data::netdb.GetRandomIntroducer (); + auto introducer = i2p::data::netdb.GetRandomIntroducer (v4); if (introducer && !requested.count (introducer)) // not requested already { - auto address = introducer->GetSSUAddress (true); // v4 + auto address = v4 ? introducer->GetSSUAddress (true) : introducer->GetSSUV6Address (); if (address && !address->host.is_unspecified ()) { boost::asio::ip::udp::endpoint ep (address->host, address->port);