From afca0fbbe38e72a1bbe44b417ffef01e93024fd1 Mon Sep 17 00:00:00 2001 From: Igor Katson Date: Sat, 7 Dec 2024 12:06:06 +0000 Subject: [PATCH] Remove unnecessary initial_peers merging code --- crates/librqbit/src/session.rs | 14 -------------- crates/librqbit/src/torrent_state/mod.rs | 2 +- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/crates/librqbit/src/session.rs b/crates/librqbit/src/session.rs index 4131c39..f942f42 100644 --- a/crates/librqbit/src/session.rs +++ b/crates/librqbit/src/session.rs @@ -1167,20 +1167,6 @@ impl Session { } } - // Merge "initial_peers" and "peer_rx" into one stream. - let peer_rx = merge_two_optional_streams( - if !seen_peers.is_empty() { - debug!( - count = seen_peers.len(), - "merging initial peers into peer_rx" - ); - Some(futures::stream::iter(seen_peers.into_iter())) - } else { - None - }, - peer_rx, - ); - let _e = managed_torrent.shared.span.clone().entered(); managed_torrent .start(peer_rx, opts.paused) diff --git a/crates/librqbit/src/torrent_state/mod.rs b/crates/librqbit/src/torrent_state/mod.rs index 3243e52..c98afd4 100644 --- a/crates/librqbit/src/torrent_state/mod.rs +++ b/crates/librqbit/src/torrent_state/mod.rs @@ -400,7 +400,7 @@ impl ManagedTorrent { } if !start_paused && peer_rx.is_none() { - bail!("logic bug: start(start_paused=true, peer_rx=None) called. peer_rx must be set if starting the torrent") + bail!("logic bug: start(start_paused=false, peer_rx=None) called. peer_rx must be set if starting the torrent") } let session = self