From: Willy Tarreau Date: Wed, 20 Dec 2017 15:14:44 +0000 (+0100) Subject: MINOR: mux: add flags to describe a mux's capabilities X-Git-Tag: v1.9-dev1~562 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=28f1cb9da281ab340c034c3ccf0f8177d1ab9858;p=thirdparty%2Fhaproxy.git MINOR: mux: add flags to describe a mux's capabilities 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. --- diff --git a/include/types/connection.h b/include/types/connection.h index 25d842b759..4bcac6079b 100644 --- a/include/types/connection.h +++ b/include/types/connection.h @@ -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 */ }; diff --git a/src/mux_h2.c b/src/mux_h2.c index 838ce952db..4ee20b492a 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -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", }; diff --git a/src/mux_pt.c b/src/mux_pt.c index 71bb477756..b32fa8edc9 100644 --- a/src/mux_pt.c +++ b/src/mux_pt.c @@ -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", };