]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
to be merged: do not count stream in error as done for arg_rconn counter
authorFrederic Lecaille <flecaille@haproxy.com>
Thu, 21 May 2026 06:19:46 +0000 (08:19 +0200)
committerFrederic Lecaille <flecaille@haproxy.com>
Fri, 22 May 2026 12:21:04 +0000 (14:21 +0200)
also rename this counter from ->tot_done ->tot_rconn_done

include/haproxy/haload.h
src/haload.c

index 04769913e80a5b476d0402035d44278236b630c2..c54be69c61cd8b326b86ae048bc48073a755bc95 100644 (file)
@@ -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;
 };
index ab8dd113ac1f5b109c5538194e4af94ccbaeb4f5..9fc0db5234ffffec0cdff60fbd2c56dfdd90da74 100644 (file)
@@ -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;