From cf3631c4c87cff322248c58c4be2bcee26d3fc8f Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Sun, 1 Feb 2026 12:19:55 -0500 Subject: [PATCH] Use peer counts in probePeers timeout --- js/webtorrent.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/webtorrent.js b/js/webtorrent.js index 4c67e45e..ac0617fe 100644 --- a/js/webtorrent.js +++ b/js/webtorrent.js @@ -415,8 +415,9 @@ export class TorrentClient { if (safeTimeout > 0) { timeoutId = setTimeout(() => { - const peers = Math.max(0, Math.floor(normalizeNumber(torrent?.numPeers, 0))); - const webseedOnly = peers === 0 && hasWebSeed; + const counts = getPeerCounts(); + const peers = Math.max(0, counts.totalPeers); + const webseedOnly = counts.regularPeers === 0 && counts.webSeeds > 0; if (typeof process !== "undefined" && process.env.NODE_ENV === "test" && !webseedOnly && hasWebSeed) { console.log(`[probePeers:timeout] logic check: peers=${peers} hasWebSeed=${hasWebSeed} webseedOnly=${webseedOnly}`); }