Reimplement maybe_transmit_haves with a broadcast channel

This commit is contained in:
Igor Katson 2024-05-03 16:49:32 +01:00
parent 7ed7e277c0
commit 44aa75f34b
3 changed files with 35 additions and 37 deletions

View file

@ -51,7 +51,8 @@ pub(crate) async fn read_metainfo_from_peer(
);
let result_reader = async move { result_rx.await? };
let connection_runner = async move { connection.manage_peer_outgoing(writer_rx).await };
let (_, brx) = tokio::sync::broadcast::channel(1);
let connection_runner = async move { connection.manage_peer_outgoing(writer_rx, brx).await };
tokio::select! {
result = result_reader => result,