From 2e5b60ee18321911450dc2b6405fa9185d8880b9 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 25 Sep 2017 11:49:03 +0200 Subject: [PATCH] MINOR: h2: add the connection and stream flags listing the causes for blocking A demux may be prevented from receiving for the following reasons : - no receive buffer could be allocated - the receive buffer is full - a response is needed and the mux is currently being used by a stream - a response is needed and some room could not be found in the mux buffer (either full or waiting for allocation) - the stream buffer is waiting for allocation - the stream buffer is full A mux may stop accepting data for the following reasons : - the buffer could not be allocated - the buffer is full A stream may stop sending data to a mux for the following reaons : - the mux is busy processing another stream - the mux buffer lacks room (full or not allocated) - the mux's flow control prevents from sending - the stream's flow control prevents from sending All these conditions were turned into flags for use by the respective places. --- src/mux_h2.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/mux_h2.c b/src/mux_h2.c index 7f968c3962..bdc21521a5 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -28,6 +28,20 @@ static struct pool_head *pool2_h2s; /* Connection flags (32 bit), in h2c->flags */ #define H2_CF_NONE 0x00000000 +/* Flags indicating why writing to the mux is blocked. */ +#define H2_CF_MUX_MALLOC 0x00000001 // mux blocked on lack of connection's mux buffer +#define H2_CF_MUX_MFULL 0x00000002 // mux blocked on connection's mux buffer full +#define H2_CF_MUX_BLOCK_ANY 0x00000003 // aggregate of the mux flags above + +/* Flags indicating why writing to the demux is blocked. */ +#define H2_CF_DEM_DALLOC 0x00000004 // demux blocked on lack of connection's demux buffer +#define H2_CF_DEM_DFULL 0x00000008 // demux blocked on connection's demux buffer full +#define H2_CF_DEM_MBUSY 0x00000010 // demux blocked on connection's mux side busy +#define H2_CF_DEM_MROOM 0x00000020 // demux blocked on lack of room in mux buffer +#define H2_CF_DEM_SALLOC 0x00000040 // demux blocked on lack of stream's request buffer +#define H2_CF_DEM_SFULL 0x00000080 // demux blocked on stream request buffer full +#define H2_CF_DEM_BLOCK_ANY 0x000000FC // aggregate of the demux flags above + /* H2 connection state, in h2c->st0 */ enum h2_cs { H2_CS_PREFACE, // init done, waiting for connection preface @@ -104,6 +118,13 @@ enum h2_ss { #define H2_SF_RST_RCVD 0x00000004 // received RST_STREAM #define H2_SF_RST_SENT 0x00000008 // sent RST_STREAM +/* stream flags indicating the reason the stream is blocked */ +#define H2_SF_BLK_MBUSY 0x00000010 // blocked waiting for mux access (transient) +#define H2_SF_BLK_MROOM 0x00000020 // blocked waiting for room in the mux +#define H2_SF_BLK_MFCTL 0x00000040 // blocked due to mux fctl +#define H2_SF_BLK_SFCTL 0x00000080 // blocked due to stream fctl +#define H2_SF_BLK_ANY 0x000000F0 // any of the reasons above + /* H2 stream descriptor, describing the stream as it appears in the H2C, and as * it is being processed in the internal HTTP representation (H1 for now). */ -- 2.47.3