]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: mux-spop: Announce the pipeling support if possible
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 9 Jul 2024 17:24:20 +0000 (19:24 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 12 Jul 2024 13:27:05 +0000 (15:27 +0200)
Reintroduce the pipelining support. Everyting was alredy in place to be able
to multiplex the streams on a SPOP connection. Here, the pipelining support
is annonced and checked in the agent replies. A hard-coded limit to 20
streams is set if the pipelining is supported on both sides. Otherwise, it
is disabled and only one stream at a time is allowed.

The related issue is #2502.

src/flt_spoe.c
src/mux_spop.c

index d6f4c4e3c3a3e9d00c05b640e38fa58f953e303e..56bb154c033ed0f955e7020a7226cbd48bd0b5a4 100644 (file)
 
 #define SPOE_CTX_FL_PROCESS (SPOE_CTX_FL_REQ_PROCESS|SPOE_CTX_FL_RSP_PROCESS)
 
-/* Flags set on the SPOE applet */
-#define SPOE_APPCTX_FL_PIPELINING    0x00000001 /* Set if pipelining is supported */
-/* unused 0x00000002 */
-/* unused 0x00000004 */
-
 /* All possible states for a SPOE context */
 enum spoe_ctx_state {
        SPOE_CTX_ST_NONE = 0,
index d1a8eac622507bd7da76ba1180ec318d5250000c..ede6e8ebcbf14224e8a8191b1bb958122def2fca 100644 (file)
@@ -705,6 +705,8 @@ static int spop_init(struct connection *conn, struct proxy *px, struct session *
        if (sdo) {
                spop_conn->agent = spoe_appctx_agent(sc_appctx(sdo->sc));
                spop_conn->max_frame_size = spop_conn->agent->max_frame_size;
+               if (spop_conn->agent->flags & SPOE_FL_PIPELINING)
+                       spop_conn->streams_limit = 20;
                BUG_ON(!spop_conn->agent);
        }
 
@@ -1685,11 +1687,11 @@ static int spop_conn_handle_hello(struct spop_conn *spop_conn)
                                /* Skip leading spaces */
                                for (; isspace((unsigned char)*str) && sz; str++, sz--);
 
-                               /* if (sz >= 10 && !strncmp(str, "pipelining", 10)) { */
-                               /*      str += 10; sz -= 10; */
-                               /*      if (!sz || isspace((unsigned char)*str) || *str == ',') */
-                               /*              flags |= SPOE_APPCTX_FL_PIPELINING; */
-                               /* } */
+                               if (sz >= 10 && !strncmp(str, "pipelining", 10)) {
+                                       str += 10; sz -= 10;
+                                       if (!sz || isspace((unsigned char)*str) || *str == ',')
+                                               flags |= SPOE_FL_PIPELINING;
+                               }
 
                                /* Get the next comma or break */
                                if (!sz || (delim = memchr(str, ',', sz)) == NULL)
@@ -1717,14 +1719,9 @@ static int spop_conn_handle_hello(struct spop_conn *spop_conn)
                spop_conn_error(spop_conn, SPOP_ERR_NO_FRAME_SIZE);
                goto fail;
        }
-       /* if (!agent) */
-       /*      flags &= ~SPOE_APPCTX_FL_PIPELINING; */
-       /* else { */
-       /*      if ((flags & SPOE_APPCTX_FL_PIPELINING) && !(agent->flags & SPOE_FL_PIPELINING)) */
-       /*              flags &= ~SPOE_APPCTX_FL_PIPELINING; */
-       /* } */
 
-       /* SPOE_APPCTX(appctx)->flags         |= flags; */
+       if (!(flags & SPOE_FL_PIPELINING))
+               spop_conn->streams_limit = 1;
        spop_conn->max_frame_size = (unsigned int)max_frame_size;