Skip to content

Commit 86a2b00

Browse files
authored
Fixed deadlock issue when requestor and responder use the same tokio event loop. (#679)
1 parent 2ac65a4 commit 86a2b00

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sctp/src/association/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ impl Association {
430430
// read from the underlying transport. We do this because the
431431
// user data is passed to the reassembly queue without
432432
// copying.
433-
log::debug!("[{}] recving {} bytes", name, n);
433+
log::debug!("[{}] receiving {} bytes", name, n);
434434
let inbound = Bytes::from(buffer[..n].to_vec());
435435
bytes_received.fetch_add(n, Ordering::SeqCst);
436436

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

0 commit comments

Comments
 (0)