Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.
Merged
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
exits send_datagram_task if the connection is closed
  • Loading branch information
behzadnouri committed Dec 5, 2023
commit 97af274378dccc6bd8f3781ae2b77b1629bb4cfd
17 changes: 14 additions & 3 deletions turbine/src/quic_endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,21 @@ async fn send_datagram_task(
connection: Connection,
mut receiver: AsyncReceiver<Bytes>,
) -> Result<(), Error> {
while let Some(bytes) = receiver.recv().await {
connection.send_datagram(bytes)?;
tokio::pin! {
let connection_closed = connection.closed();
}
loop {
tokio::select! {
biased;
bytes = receiver.recv() => {
match bytes {
None => return Ok(()),
Some(bytes) => connection.send_datagram(bytes)?,
}
}
err = &mut connection_closed => return Err(Error::from(err)),
}
}
Ok(())
}

async fn make_connection_task(
Expand Down