From 2459ae5917e89d9b9b93834d28f14164e7f367a0 Mon Sep 17 00:00:00 2001 From: Frederic Lecaille Date: Thu, 21 May 2026 08:19:46 +0200 Subject: [PATCH] to be merged: do not count stream in error as done for arg_rconn counter also rename this counter from ->tot_done ->tot_rconn_done --- include/haproxy/haload.h | 2 +- src/haload.c | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/include/haproxy/haload.h b/include/haproxy/haload.h index 04769913e..c54be69c6 100644 --- a/include/haproxy/haload.h +++ b/include/haproxy/haload.h @@ -29,7 +29,7 @@ struct hld_url { int mreqs; int flags; uint64_t tot_req; - uint64_t tot_done; + uint64_t tot_rconn_done; struct hld_url_cfg *cfg; struct hld_url *next; }; diff --git a/src/haload.c b/src/haload.c index ab8dd113a..9fc0db523 100644 --- a/src/haload.c +++ b/src/haload.c @@ -1365,27 +1365,26 @@ static struct task *hld_strm_task(struct task *t, void *context, unsigned int st return t; done: url->mreqs++; - url->tot_done++; - BUG_ON(arg_rcon > 0 && url->tot_done > arg_rcon); + url->tot_rconn_done++; + BUG_ON(arg_rcon > 0 && url->tot_rconn_done > arg_rcon); task_wakeup(usr->task, TASK_WOKEN_IO); LIST_DELETE(&hs->list); hldstream_free(&hs); t = NULL; - if (arg_rcon > 0 && url->tot_done == arg_rcon && conn && conn->mux) { + if (arg_rcon > 0 && url->tot_rconn_done == arg_rcon && conn && conn->mux) { /* All the streams attached to this connection will be release */ TRACE_STATE("releasing connection", HLD_EV_USR_TASK, hs); conn->mux->destroy(conn->ctx); /* Reset this counter here. Cannot be done elsewhere */ - url->tot_done = 0; + url->tot_rconn_done = 0; } goto leave; err: TRACE_DEVEL("leaving on error", HLD_STRM_EV_TASK, hs); thrs_info[tid].tot_perr++; url->mreqs++; - url->tot_done++; - BUG_ON(arg_rcon > 0 && url->tot_done > arg_rcon); + BUG_ON(arg_rcon > 0 && url->tot_rconn_done > arg_rcon); task_wakeup(usr->task, TASK_WOKEN_IO); LIST_DELETE(&hs->list); hldstream_free(&hs); @@ -1527,7 +1526,6 @@ static struct task *hld_usr_task(struct task *t, void *context, unsigned int sta thrs_info[tid].tot_done++; hs->url->mreqs++; - hs->url->tot_done++; usr->nreqs = usr->nreqs == -1 ? -1 : usr->nreqs + 1; LIST_DELETE(&hs->list); hldstream_free(&hs); @@ -1537,8 +1535,8 @@ static struct task *hld_usr_task(struct task *t, void *context, unsigned int sta struct hld_path *path, *paths = url->cfg->paths; nreqs = usr->nreqs >= 0 ? MIN(usr->nreqs, url->mreqs) : url->mreqs; - BUG_ON(arg_rcon > 0 && url->tot_done > arg_rcon); - nreqs = arg_rcon > 0 ? MIN(arg_rcon - url->tot_done, nreqs) : nreqs; + BUG_ON(arg_rcon > 0 && url->tot_rconn_done > arg_rcon); + nreqs = arg_rcon > 0 ? MIN(arg_rcon - url->tot_rconn_done, nreqs) : nreqs; DDPRINTF(stderr, "\n%s: url:%s url == first_url? %d usr->nreqs=%d nreqs=%d remain=%d url->mreqs=%d\n", __func__, url->cfg->addr, url == first_url, usr->nreqs, nreqs, remain, url->mreqs); @@ -1628,7 +1626,7 @@ static inline struct hld_usr *hld_new_usr(int nreqs) goto err; url->tot_req = 0; - url->tot_done = 0; + url->tot_rconn_done = 0; url->mreqs = arg_mreqs; url->flags = 0; url->cfg = cfg;