]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stream-int/conn-stream: Move half-close timeout in the conn-stream
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 29 Mar 2022 16:03:35 +0000 (18:03 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 13 Apr 2022 13:10:14 +0000 (15:10 +0200)
The half-close timeout (hcto) is now part of the conn-stream. It is a step
closer to the stream-interface removal.

include/haproxy/conn_stream-t.h
include/haproxy/stream_interface-t.h
src/cli.c
src/conn_stream.c
src/proxy.c
src/stream.c
src/stream_interface.c

index fdaa6c3b25195fb1c30add980642d2f7e8495d4d..55f338b095b1a33f2a59a58e61cfdf45bfabf85a 100644 (file)
@@ -124,6 +124,7 @@ struct conn_stream {
        enum obj_type obj_type;              /* differentiates connection from applet context */
        /* 3 bytes hole here */
        unsigned int flags;                  /* CS_FL_* */
+       unsigned int hcto;                   /* half-closed timeout (0 = unset) */
        struct cs_endpoint *endp;            /* points to the end point (MUX stream or appctx) */
        enum obj_type *app;                  /* points to the applicative point (stream or check) */
        struct stream_interface *si;
index d9f1242c0ffecbca2cd86002153952738003e725..d01cea294699562a780db80a8b05a0abcc1bd51e 100644 (file)
@@ -130,7 +130,6 @@ struct stream_interface {
        /* struct members below are the "remote" part, as seen from the buffer side */
        unsigned int err_type;  /* first error detected, one of SI_ET_* */
 
-       unsigned int hcto;      /* half-closed timeout (0 = unset) */
        struct wait_event wait_event; /* We're in a wait list */
 };
 
index 9b5337060e73a92be4a03774a51cd53c56c66389..a1ab7e2d1cd57acebe63ce2b5c5ca44c1cd80fae 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -2822,7 +2822,7 @@ int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
                s->res.rex = TICK_ETERNITY;
                s->res.wex = TICK_ETERNITY;
                s->res.analyse_exp = TICK_ETERNITY;
-               cs_si(s->csb)->hcto = TICK_ETERNITY;
+               s->csb->hcto = TICK_ETERNITY;
 
                /* we're removing the analysers, we MUST re-enable events detection.
                 * We don't enable close on the response channel since it's either
index 55dd86cd9d917d9811807a4d91cb4814a5599b0e..e5a3ad79a3b8927a79c17c7f7d17b05a25474389 100644 (file)
@@ -57,6 +57,7 @@ struct conn_stream *cs_new(struct cs_endpoint *endp)
 
        cs->obj_type = OBJ_TYPE_CS;
        cs->flags = CS_FL_NONE;
+       cs->hcto = TICK_ETERNITY;
        cs->app = NULL;
        cs->si = NULL;
        cs->data_cb = NULL;
index 5024178735ec949ccf84b78a7c449ebf25c580f0..70710d023597697b56272f5bd1215ae5927b9e9b 100644 (file)
@@ -2310,7 +2310,7 @@ int stream_set_backend(struct stream *s, struct proxy *be)
                cs_si(s->csb)->flags |= SI_FL_INDEP_STR;
 
        if (tick_isset(be->timeout.serverfin))
-               cs_si(s->csb)->hcto = be->timeout.serverfin;
+               s->csb->hcto = be->timeout.serverfin;
 
        /* We want to enable the backend-specific analysers except those which
         * were already run as part of the frontend/listener. Note that it would
index 200f69efd770b305736a8319dd2116e2ce290786..eceea2eb2776573fd25e36b8708bfc78b0e71799 100644 (file)
@@ -454,13 +454,13 @@ struct stream *stream_new(struct session *sess, struct conn_stream *cs, struct b
                goto out_fail_alloc_csb;
 
        si_set_state(cs_si(s->csf), SI_ST_EST);
-       cs_si(s->csf)->hcto = sess->fe->timeout.clientfin;
+       s->csf->hcto = sess->fe->timeout.clientfin;
 
        if (likely(sess->fe->options2 & PR_O2_INDEPSTR))
                cs_si(s->csf)->flags |= SI_FL_INDEP_STR;
 
        cs_si(s->csb)->flags = SI_FL_ISBACK;
-       cs_si(s->csb)->hcto = TICK_ETERNITY;
+       s->csb->hcto = TICK_ETERNITY;
        if (likely(sess->fe->options2 & PR_O2_INDEPSTR))
                cs_si(s->csb)->flags |= SI_FL_INDEP_STR;
 
index b4d7cab75421c3b0afe682e7013ab2512a3a8c8b..9be918b3fd72f73378a15b6e051f0460117b9444 100644 (file)
@@ -237,8 +237,8 @@ static void stream_int_shutw(struct stream_interface *si)
        oc->wex = TICK_ETERNITY;
        si_done_get(si);
 
-       if (tick_isset(si->hcto)) {
-               ic->rto = si->hcto;
+       if (tick_isset(si->cs->hcto)) {
+               ic->rto = si->cs->hcto;
                ic->rex = tick_add(now_ms, ic->rto);
        }
 
@@ -1106,8 +1106,8 @@ static void stream_int_shutw_conn(struct stream_interface *si)
        oc->wex = TICK_ETERNITY;
        si_done_get(si);
 
-       if (tick_isset(si->hcto)) {
-               ic->rto = si->hcto;
+       if (tick_isset(si->cs->hcto)) {
+               ic->rto = si->cs->hcto;
                ic->rex = tick_add(now_ms, ic->rto);
        }
 
@@ -1756,8 +1756,8 @@ static void stream_int_shutw_applet(struct stream_interface *si)
        oc->wex = TICK_ETERNITY;
        si_done_get(si);
 
-       if (tick_isset(si->hcto)) {
-               ic->rto = si->hcto;
+       if (tick_isset(si->cs->hcto)) {
+               ic->rto = si->cs->hcto;
                ic->rex = tick_add(now_ms, ic->rto);
        }