Skip to content

Fix deadlock in data-channels-flow-control example. #679

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

Merged
merged 1 commit into from
May 27, 2025
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
5 changes: 4 additions & 1 deletion sctp/src/association/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ impl Association {
// read from the underlying transport. We do this because the
// user data is passed to the reassembly queue without
// copying.
log::debug!("[{}] recving {} bytes", name, n);
log::debug!("[{}] receiving {} bytes", name, n);
let inbound = Bytes::from(buffer[..n].to_vec());
bytes_received.fetch_add(n, Ordering::SeqCst);

Expand Down Expand Up @@ -468,6 +468,9 @@ impl Association {
'outer: while !done.load(Ordering::Relaxed) {
//log::debug!("[{}] gather_outbound begin", name);
let (packets, continue_loop) = {
// Yielding here fixes a deadlock that crops up when requestor and responder are
// using the same tokio event loop as in examples/data=channels-flow-control
tokio::task::yield_now().await;
let mut ai = association_internal.lock().await;
ai.gather_outbound().await
};
Expand Down
Loading