Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(iroh-gossip): do not drop existing peer connection when we get incoming one #2310

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions iroh-gossip/src/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -619,11 +619,13 @@ async fn connection_loop(
loop {
tokio::select! {
biased;
msg = send_rx.recv() => {
match msg {
None => break,
Some(msg) => write_message(&mut send, &mut send_buf, &msg).await?,
}
// 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.
Some(msg) = send_rx.recv(), if !send_rx.is_closed() => {
write_message(&mut send, &mut send_buf, &msg).await?
}

msg = read_message(&mut recv, &mut recv_buf) => {
Expand Down
Loading