aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2024-04-22 19:44:42 -0600
committerJens Axboe <axboe@kernel.dk>2024-04-22 19:44:42 -0600
commite11e6175ca0f0c0a2d579534136710ad2ddc4577 (patch)
treea62860d55bce5c6f1f047912aaf1c66a56368d25
parent3331290311608f6c671278dd00e4d54934117f38 (diff)
downloadliburing-e11e6175ca0f0c0a2d579534136710ad2ddc4577.tar.gz
examples/proxy: increment open_conns early for sink mode
It never goes through socket/connect, so do it upfront when we're set up for communication. Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--examples/proxy.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/examples/proxy.c b/examples/proxy.c
index 5332456..3857c42 100644
--- a/examples/proxy.c
+++ b/examples/proxy.c
@@ -1703,6 +1703,10 @@ static int handle_cancel(struct io_uring *ring, struct io_uring_cqe *cqe)
static void open_socket(struct conn *c)
{
if (is_sink) {
+ pthread_mutex_lock(&thread_lock);
+ open_conns++;
+ pthread_mutex_unlock(&thread_lock);
+
submit_receive(&c->ring, c);
} else {
struct io_uring_sqe *sqe;