From 19e0586b4ada82e6229a2df01b4d4ee81ef7b5d0 Mon Sep 17 00:00:00 2001 From: orignal Date: Sun, 6 Sep 2026 08:35:10 -0400 Subject: [PATCH] check if magnet is not ready for status update and tracket info --- libi2pd_client/Torrents.cpp | 1 + libi2pd_client/TorrentsRPC.cpp | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libi2pd_client/Torrents.cpp b/libi2pd_client/Torrents.cpp index 07776fc6..a201eb97 100644 --- a/libi2pd_client/Torrents.cpp +++ b/libi2pd_client/Torrents.cpp @@ -707,6 +707,7 @@ namespace torrents bool Torrent::UpdateStatus (uint64_t ts) { + if (!m_Length) return false; // non ready magnet bool complete = true; for (auto& it: m_Pieces) { diff --git a/libi2pd_client/TorrentsRPC.cpp b/libi2pd_client/TorrentsRPC.cpp index 0ed6f0b3..aea5387b 100644 --- a/libi2pd_client/TorrentsRPC.cpp +++ b/libi2pd_client/TorrentsRPC.cpp @@ -441,8 +441,9 @@ namespace torrents tracker["lastAnnounceSucceeded"] = false; } tracker["lastAnnounceTimedOut"] = false; // TODO: - tracker["nextAnnounceTime"] = (torrent->GetNextTrackerRequestTime (i) - - i2p::util::GetMonotonicMilliseconds () + i2p::util::GetMillisecondsSinceEpoch ())/1000; + auto nextRequestTime = torrent->GetNextTrackerRequestTime (i); + tracker["nextAnnounceTime"] = ((nextRequestTime ? torrent->GetNextTrackerRequestTime (i) - + i2p::util::GetMonotonicMilliseconds () : 0) + i2p::util::GetMillisecondsSinceEpoch ())/1000; tracker["lastAnnounceTime"] = torrent->GetLastTrackerUpdateTime (i); tracker["lastAnnounceStartTime"] = torrent->GetLastTrackerUpdateTime (i); // TODO: tracker["lastScrapeTime"] = 0;