Peer stream is more efficient

This commit is contained in:
Igor Katson 2021-07-14 15:29:59 +01:00
parent 9340c231ba
commit 3a9a858438
6 changed files with 109 additions and 63 deletions

View file

@ -103,8 +103,6 @@ mod tests {
let dht = Dht::new().await.unwrap();
let peer_rx = dht.get_peers(info_hash).await.unwrap();
let peer_id = generate_peer_id();
let peer_rx = peer_rx.filter_map(|r| async move { r.ok() });
tokio::pin!(peer_rx);
match read_metainfo_from_peer_receiver(peer_id, info_hash, peer_rx, None).await {
ReadMetainfoResult::Found { info, .. } => dbg!(info),
ReadMetainfoResult::ChannelClosed { .. } => todo!("should not have happened"),