From b40d33b0ad47c604536e9bc6a74ea77186ec3360 Mon Sep 17 00:00:00 2001 From: Igor Katson Date: Sun, 19 Nov 2023 21:29:42 +0000 Subject: [PATCH] Fix a bug with wrong number of queued peers --- crates/librqbit/src/torrent_state.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/librqbit/src/torrent_state.rs b/crates/librqbit/src/torrent_state.rs index b9180e8..b8ff1e9 100644 --- a/crates/librqbit/src/torrent_state.rs +++ b/crates/librqbit/src/torrent_state.rs @@ -667,6 +667,8 @@ impl TorrentState { } } PeerState::NotNeeded => { + // Restore it as std::mem::take() replaced it above. + pe.value_mut().state = PeerState::NotNeeded; return; } s @ PeerState::Queued | s @ PeerState::Dead => {