drop interval to minimal if a tracker is not responding

This commit is contained in:
orignal
2026-09-18 17:45:18 -04:00
parent fadc607440
commit 007d7a4357
3 changed files with 10 additions and 0 deletions
+6
View File
@@ -764,6 +764,12 @@ namespace torrents
0, 0, 0, i2p::util::GetSecondsSinceEpoch (), ""});
}
void Torrent::SetInterval (size_t trackerID, int interval)
{
CheckTrackerStatsSize (trackerID);
std::get<1>(m_TrackerStats[trackerID]) = interval;
}
std::pair<std::vector<uint8_t>, boost::logic::tribool> Torrent::CreateBitfield () const
{
size_t numPieces = m_Pieces.size ();
+1
View File
@@ -245,6 +245,7 @@ namespace torrents
size_t GetLength () const { return m_Length; }
size_t GetPieceLength () const { return m_PieceLength; }
int GetInterval (size_t trackerID) const { return (trackerID < m_TrackerStats.size ()) ? std::get<1>(m_TrackerStats[trackerID]) : MIN_TRACKER_REQUESTS_INTERVAL; }
void SetInterval (size_t trackerID, int interval);
const std::vector<uint8_t> GetInfo () const { return m_Info; }
const InfoHash& GetInfoHash () const { return m_InfoHash; }
size_t GetLeft () const;
+3
View File
@@ -759,7 +759,10 @@ namespace torrents
if (ts >= it.second->GetNextTrackerRequestTime (i))
{
if (i2p::util::GetSecondsSinceEpoch () > it.second->GetLastTrackerUpdateTime (i) + 2*it.second->GetInterval (i)/1000 && it.second->GetTrackerError (i).empty ())
{
it.second->SetTrackerError (i, "No response");
it.second->SetInterval (i, MIN_TRACKER_REQUESTS_INTERVAL); // try again shortly
}
if (RequestTracker (i, it.second, eTrackerAnnounceEventNone))
{
auto nextInterval = it.second->GetInterval (i) + GetLocalDestination ()->GetRng()() % TRACKER_REQUESTS_INTERVAL_VARIANCE;