aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2024-02-19 12:25:28 -0700
committerJens Axboe <axboe@kernel.dk>2024-02-19 12:25:28 -0700
commit4e6429586d5a08371f7c7a84de1e84523e5b5720 (patch)
tree08ea0bcf7376709ea9db052448f20f7d93f01073
parent6a5174b3dccf7f4d04506829b24f001d312abc14 (diff)
downloadliburing-4e6429586d5a08371f7c7a84de1e84523e5b5720.tar.gz
examples/proxy: fix hang for -ENOBUFS and no pending sends
If we have no pending sends, just rearm the submit. Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--examples/proxy.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/proxy.c b/examples/proxy.c
index fb88fdfd..525f3003 100644
--- a/examples/proxy.c
+++ b/examples/proxy.c
@@ -535,16 +535,16 @@ static void handle_enobufs(struct io_uring *ring, struct conn *c,
cd->enobufs++;
+ send_waits = nr_bufs / 2;
+ if (send_ring)
+ send_waits = c->cd[0].pending_sends + c->cd[1].pending_sends;
+
/* sink has no sends to wait for, no choice but to re-arm */
- if (is_sink) {
+ if (is_sink || !send_waits) {
__submit_receive(ring, c, fd);
return;
}
- send_waits = nr_bufs / 2;
- if (send_ring)
- send_waits = c->cd[0].pending_sends + c->cd[1].pending_sends;
-
cd->rearm_recv = send_waits;
/* really shouldn't use 1 buffer ring... */