From: Christopher Faulet Date: Thu, 21 Apr 2022 06:38:54 +0000 (+0200) Subject: CLEANUP: conn-stream: Rename cs_conn_close() and cs_conn_drain_and_close() X-Git-Tag: v2.6-dev7~19 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ff022a2b8cf41cae8bc66201202657826e86f156;p=thirdparty%2Fhaproxy.git CLEANUP: conn-stream: Rename cs_conn_close() and cs_conn_drain_and_close() These functions don't close the connection but only perform shutdown for reads and writes at the mux level. It is a bit ambiguous. Thus, cs_conn_close() is renamed cs_conn_shut() and cs_conn_drain_and_close() is renamed cs_conn_drain_and_shut(). These both functions rely on cs_conn_shutw() and cs_conn_shutr(). --- diff --git a/include/haproxy/conn_stream.h b/include/haproxy/conn_stream.h index ee5a3de3d1..604ccd4344 100644 --- a/include/haproxy/conn_stream.h +++ b/include/haproxy/conn_stream.h @@ -193,14 +193,14 @@ static inline void cs_conn_shutw(struct conn_stream *cs, enum co_shw_mode mode) } /* completely close a conn_stream (but do not detach it) */ -static inline void cs_conn_close(struct conn_stream *cs) +static inline void cs_conn_shut(struct conn_stream *cs) { cs_conn_shutw(cs, CO_SHW_SILENT); cs_conn_shutr(cs, CO_SHR_RESET); } /* completely close a conn_stream after draining possibly pending data (but do not detach it) */ -static inline void cs_conn_drain_and_close(struct conn_stream *cs) +static inline void cs_conn_drain_and_shut(struct conn_stream *cs) { cs_conn_shutw(cs, CO_SHW_SILENT); cs_conn_shutr(cs, CO_SHR_DRAIN); diff --git a/src/check.c b/src/check.c index defe296bae..71d3f3cdd5 100644 --- a/src/check.c +++ b/src/check.c @@ -1054,7 +1054,7 @@ static int wake_srv_chk(struct conn_stream *cs) * handled ASAP. */ ret = -1; if (conn) { - cs_conn_drain_and_close(cs); + cs_conn_drain_and_shut(cs); if (check->wait_list.events) conn->mux->unsubscribe(cs, check->wait_list.events, &check->wait_list); } @@ -1188,7 +1188,7 @@ struct task *process_chk_conn(struct task *t, void *context, unsigned int state) * as a failed response coupled with "observe layer7" caused the * server state to be suddenly changed. */ - cs_conn_drain_and_close(cs); + cs_conn_drain_and_shut(cs); } if (cs) { diff --git a/src/conn_stream.c b/src/conn_stream.c index 2a3ff564ad..e37e8ea824 100644 --- a/src/conn_stream.c +++ b/src/conn_stream.c @@ -645,7 +645,7 @@ static void cs_app_shutr_conn(struct conn_stream *cs) return; if (cs_oc(cs)->flags & CF_SHUTW) { - cs_conn_close(cs); + cs_conn_shut(cs); cs->state = CS_ST_DIS; __cs_strm(cs)->conn_exp = TICK_ETERNITY; } @@ -721,7 +721,7 @@ static void cs_app_shutw_conn(struct conn_stream *cs) /* we may have to close a pending connection, and mark the * response buffer as shutr */ - cs_conn_close(cs); + cs_conn_shut(cs); /* fall through */ case CS_ST_CER: case CS_ST_QUE: @@ -1252,7 +1252,7 @@ static void cs_conn_read0(struct conn_stream *cs) do_close: /* OK we completely close the socket here just as if we went through cs_shut[rw]() */ - cs_conn_close(cs); + cs_conn_shut(cs); oc->flags &= ~CF_SHUTW_NOW; oc->flags |= CF_SHUTW;