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

Method HandleDatabaseSearchReplyMessage

libi2pd/Destination.cpp:533–555  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

531 }
532
533 void LeaseSetDestination::HandleDatabaseSearchReplyMessage (const uint8_t * buf, size_t len)
534 {
535 i2p::data::IdentHash key (buf);
536 int num = buf[32]; // num
537 LogPrint (eLogDebug, "Destination: DatabaseSearchReply for ", key.ToBase64 (), " num=", num);
538 auto it = m_LeaseSetRequests.find (key);
539 if (it != m_LeaseSetRequests.end ())
540 {
541 auto request = it->second;
542 for (int i = 0; i < num; i++)
543 {
544 i2p::data::IdentHash peerHash (buf + 33 + i*32);
545 if (!request->excluded.count (peerHash) && !i2p::data::netdb.FindRouter (peerHash))
546 {
547 LogPrint (eLogInfo, "Destination: Found new floodfill, request it");
548 i2p::data::netdb.RequestDestination (peerHash, nullptr, false); // through exploratory
549 }
550 }
551 SendNextLeaseSetRequest (key, request);
552 }
553 else
554 LogPrint (eLogWarning, "Destination: Request for ", key.ToBase64 (), " not found");
555 }
556
557 void LeaseSetDestination::SendNextLeaseSetRequest (const i2p::data::IdentHash& key,
558 std::shared_ptr<LeaseSetRequest> request)

Callers

nothing calls this directly

Calls 4

LogPrintFunction · 0.85
ToBase64Method · 0.80
FindRouterMethod · 0.80
RequestDestinationMethod · 0.45

Tested by

no test coverage detected