Skip to content

Commit

Permalink
fix(iroh-gossip): do not drop existing peer connection when we get in…
Browse files Browse the repository at this point in the history
…coming one
  • Loading branch information
link2xt committed May 19, 2024
1 parent 26405a4 commit 703a6ad
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions iroh-gossip/src/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -616,12 +616,17 @@ async fn connection_loop(
};
let mut send_buf = BytesMut::new();
let mut recv_buf = BytesMut::new();
let mut tx_open = true;
loop {
tokio::select! {
biased;
msg = send_rx.recv() => {
msg = send_rx.recv(), if tx_open => {
match msg {
None => break,
None => {
// Channel is closed and is always ready to return None now,
// stop polling it.
tx_open = false;
}
Some(msg) => write_message(&mut send, &mut send_buf, &msg).await?,
}
}
Expand Down

0 comments on commit 703a6ad

Please sign in to comment.