We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d813089 commit e41d1d9Copy full SHA for e41d1d9
iroh-gossip/src/net.rs
@@ -615,11 +615,13 @@ async fn connection_loop(
615
loop {
616
tokio::select! {
617
biased;
618
- msg = send_rx.recv() => {
619
- match msg {
620
- None => break,
621
- Some(msg) => write_message(&mut send, &mut send_buf, &msg).await?,
622
- }
+ // If `send_rx` is closed,
+ // stop selecting it but don't quit.
+ // We are not going to use connection for sending anymore,
+ // but the other side may still want to use it to
+ // send data to us.
623
+ Some(msg) = send_rx.recv(), if !send_rx.is_closed() => {
624
+ write_message(&mut send, &mut send_buf, &msg).await?
625
}
626
627
msg = read_message(&mut recv, &mut recv_buf) => {
0 commit comments