From 79dadb5335e933d085baf1a8b518ceb951f87a9d Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 5 Oct 2017 15:06:07 +0200 Subject: [PATCH] MINOR: conn_stream: new shutr/w status flags In order to support all shutdown modes on the CS, we introduce the following flags : CS_FL_SHRD : shut read, drain extra data CS_FL_SHRR : shut read, reset extra data CS_FL_SHWN : shut write, normal notification CS_FL_SHWS : shut write, silent mode (no notification) And the following modes for shutr/shutw : CS_SHR_DRAIN, CS_SHR_RESET, CS_SHW_NORMAL, CS_SHW_SILENT. Note: it's possible that we won't need to distinguish the two shutw above as they're only an action. For now they are not used. --- include/types/connection.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/include/types/connection.h b/include/types/connection.h index 0d62efc99..1b3e73a8c 100644 --- a/include/types/connection.h +++ b/include/types/connection.h @@ -58,10 +58,31 @@ enum { CS_FL_DATA_RD_ENA = 0x00000001, /* receiving data is allowed */ CS_FL_DATA_WR_ENA = 0x00000002, /* sending data is desired */ + CS_FL_SHRD = 0x00000010, /* read shut, draining extra data */ + CS_FL_SHRR = 0x00000020, /* read shut, resetting extra data */ + CS_FL_SHR = CS_FL_SHRD | CS_FL_SHRR, /* read shut status */ + + CS_FL_SHWN = 0x00000040, /* write shut, verbose mode */ + CS_FL_SHWS = 0x00000080, /* write shut, silent mode */ + CS_FL_SHW = CS_FL_SHWN | CS_FL_SHWS, /* write shut status */ + + CS_FL_ERROR = 0x00000100, /* a fatal error was reported */ CS_FL_EOS = 0x00001000, /* End of stream */ }; +/* cs_shutr() modes */ +enum cs_shr_mode { + CS_SHR_DRAIN = 0, /* read shutdown, drain any extra stuff */ + CS_SHR_RESET = 1, /* read shutdown, reset any extra stuff */ +}; + +/* cs_shutw() modes */ +enum cs_shw_mode { + CS_SHW_NORMAL = 0, /* regular write shutdown */ + CS_SHW_SILENT = 1, /* imminent close, don't notify peer */ +}; + /* For each direction, we have a CO_FL_{SOCK,DATA}__ENA flag, which * indicates if read or write is desired in that direction for the respective * layers. The current status corresponding to the current layer being used is