From e07e8339c2ed805c6bc0bcf13cda3532edcf94e7 Mon Sep 17 00:00:00 2001 From: orignal Date: Fri, 2 Oct 2026 17:01:28 -0400 Subject: [PATCH] always call find_node from bucket with own node. Call find_node more often --- libi2pd_client/TorrentsDHT.cpp | 4 ++-- libi2pd_client/TorrentsDHT.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libi2pd_client/TorrentsDHT.cpp b/libi2pd_client/TorrentsDHT.cpp index d8c82f00..2ce35661 100644 --- a/libi2pd_client/TorrentsDHT.cpp +++ b/libi2pd_client/TorrentsDHT.cpp @@ -299,7 +299,7 @@ namespace torrents auto bucket = m_Buckets; while (bucket) { - if (!bucket->IsFull () && !bucket->nodes.empty ()) + if ((!bucket->IsFull () || bucket->IsInBucket (m_OurNode)) && !bucket->nodes.empty ()) { auto randomID = bucket->GetRandomID (rng); auto closestNode = FindClosestNodeInBucket (randomID); @@ -506,7 +506,7 @@ namespace torrents std::set, std::function&, const std::shared_ptr&)> > sortedNodes ([](const std::shared_ptr& n1, const std::shared_ptr& n2)->bool { - return n2->id > n1->id; + return n1->id > n2->id; }); while (f.read ((char *)nodeInfo.data (), nodeInfo.size ())) { diff --git a/libi2pd_client/TorrentsDHT.h b/libi2pd_client/TorrentsDHT.h index 87b51d56..7607f834 100644 --- a/libi2pd_client/TorrentsDHT.h +++ b/libi2pd_client/TorrentsDHT.h @@ -40,7 +40,7 @@ namespace torrents constexpr int DHT_UPDATE_CHECK_INTERVAL = 24; // in seconds constexpr int DHT_EXPIRATION_CHECK_INTERVAL = 73; // in seconds constexpr int DHT_SEND_PING_CHECK_INTERVAL = 38; // in seconds - constexpr int DHT_EXPLORATORY_INTERVAL = 4*60; // in seconds + constexpr int DHT_EXPLORATORY_INTERVAL = 130; // in seconds constexpr int DHT_EXPLORATORY_INTERVAL_VARIANCE = 40; // in seconds constexpr int DHT_INITIAL_EXPLORATORY_INTERVAL = 90; // in seconds constexpr int DHT_NODE_SEND_PING_TIME = 740; // in seconds