]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stconn: Add a field to specify the room needed by the SC to progress
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 5 May 2023 09:25:19 +0000 (11:25 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 5 May 2023 13:41:30 +0000 (15:41 +0200)
When the SC is blocked because it is waiting for room in the input buffer,
it will be responsible to specify the minimum free space required to
progress. In this commit, we only introduce the field in the stconn
structure that will be used to store this value. It is a signed value with
the following meaning:

  * -1: The SC is waiting for room but not based on the buffer state. It
        will be typically used during splicing when the pipe is full. In
        this case, only a successful send can unblock the SC.

  * >= 0; The minimum free space in the input buffer to unblock the SC. 0 is
          a special value to specify the SC must be unblocked ASAP, by the
          stream, at the end of process_stream() or when output data are
          consumed on the opposite side.

include/haproxy/stconn-t.h
src/stconn.c

index e2f13f101cf6e48060b9b9d6cb531de1d55df963..4396b02cdf87ace9248678bbcb07236aad63ef94 100644 (file)
@@ -284,6 +284,10 @@ struct stconn {
 
        unsigned int flags;                  /* SC_FL_* */
        unsigned int ioto;                   /* I/O activity timeout */
+       ssize_t room_needed;                 /* free space in the input buffer required to receive more data.
+                                             *    -1   : the SC is waiting for room but not on a specific amount of data
+                                             *    >= 0 : min free space required to progress. 0 means SC must be unblocked ASAP
+                                             */
        struct wait_event wait_event;        /* We're in a wait list */
        struct sedesc *sedesc;               /* points to the stream endpoint descriptor */
        enum obj_type *app;                  /* points to the applicative point (stream or check) */
index 8458331895d6d57f83a04560a5e9be62c0008b63..cb3d750a8a79ffec02311a2509234234e91adef5 100644 (file)
@@ -136,6 +136,7 @@ static struct stconn *sc_new(struct sedesc *sedesc)
        sc->flags = SC_FL_NONE;
        sc->state = SC_ST_INI;
        sc->ioto = TICK_ETERNITY;
+       sc->room_needed = 0;
        sc->app = NULL;
        sc->app_ops = NULL;
        sc->src = NULL;