From 68ae45dd5892c7caaa8855ca64798f16a620ac4a Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Wed, 11 Dec 2024 20:53:25 -0500 Subject: [PATCH] ssb: Prevent -t=bench from stalling. --- src/ssb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ssb.c b/src/ssb.c index bbb3fb8f..de3f974c 100644 --- a/src/ssb.c +++ b/src/ssb.c @@ -665,7 +665,7 @@ static void _tf_ssb_connection_box_stream_send(tf_ssb_connection_t* connection, static void _tf_ssb_connection_dispatch_scheduled(tf_ssb_connection_t* connection) { - while ((connection->active_write_count == 0 || connection->closing) && connection->scheduled_count && connection->scheduled) + while (((connection->active_write_count == 0 && connection->read_back_pressure == 0) || connection->closing) && connection->scheduled_count && connection->scheduled) { tf_ssb_connection_scheduled_t scheduled = connection->scheduled[0]; memmove(connection->scheduled, connection->scheduled + 1, sizeof(tf_ssb_connection_scheduled_t) * (connection->scheduled_count - 1)); @@ -4376,6 +4376,7 @@ void tf_ssb_connection_adjust_read_backpressure(tf_ssb_connection_t* connection, const int k_threshold = 256; int old_pressure = connection->read_back_pressure; connection->read_back_pressure += delta; + _tf_ssb_connection_dispatch_scheduled(connection); if (!connection->closing) { if (old_pressure < k_threshold && connection->read_back_pressure >= k_threshold)