]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux: add flags to describe a mux's capabilities
authorWilly Tarreau <w@1wt.eu>
Wed, 20 Dec 2017 15:14:44 +0000 (16:14 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 20 Dec 2017 15:31:30 +0000 (16:31 +0100)
This new field will be used to describe certain properties of some
muxes. For now we only add MX_FL_CLEAN_ABRT to indicate that a mux
is able to unambiguously report aborts using CS_FL_ERROR contrary
to others who may only report it via a read0. This will be used to
improve handling of the abortonclose option with H2. Other flags
may come later to report multiplexing capabilities or not, support
of client/server sides etc.

include/types/connection.h
src/mux_h2.c
src/mux_pt.c

index 25d842b759a5591440c41ebeeec065df8c6cbb72..4bcac6079bffa61c9c6bef7eb83e7694164cce84 100644 (file)
@@ -255,6 +255,12 @@ enum {
        XPRT_ENTRIES /* must be last one */
 };
 
+/* MUX-specific flags */
+enum {
+       MX_FL_NONE        = 0x00000000,
+       MX_FL_CLEAN_ABRT  = 0x00000001, /* abort is clearly reported as an error */
+};
+
 /* xprt_ops describes transport-layer operations for a connection. They
  * generally run over a socket-based control layer, but not always. Some
  * of them are used for data transfer with the upper layer (rcv_*, snd_*)
@@ -299,6 +305,7 @@ struct mux_ops {
 
        struct conn_stream *(*attach)(struct connection *); /* Create and attach a conn_stream to an outgoing connection */
        void (*detach)(struct conn_stream *); /* Detach a conn_stream from an outgoing connection, when the request is done */
+       unsigned int flags;                           /* some flags characterizing the mux's capabilities (MX_FL_*) */
        char name[8];                                 /* mux layer name, zero-terminated */
 };
 
index 838ce952db01d2d1849d06e2ec0caae5a1b5036f..4ee20b492aba4b161645d6572af4ad05f77d0e49 100644 (file)
@@ -3330,6 +3330,7 @@ const struct mux_ops h2_ops = {
        .detach = h2_detach,
        .shutr = h2_shutr,
        .shutw = h2_shutw,
+       .flags = MX_FL_CLEAN_ABRT,
        .name = "H2",
 };
 
index 71bb477756a99127821846f93481edb346fd6b34..b32fa8edc93736a59cdc088e641b9fe53c696db5 100644 (file)
@@ -214,6 +214,7 @@ const struct mux_ops mux_pt_ops = {
        .detach = mux_pt_detach,
        .shutr = mux_pt_shutr,
        .shutw = mux_pt_shutw,
+       .flags = MX_FL_NONE,
        .name = "PASS",
 };