mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-28 06:11:32 +01:00
MINOR: conn-stream: Rename CS functions dedicated to connections
Some conn-stream functions are only used when there is a connection. Thus, they was renamed with "cs_conn_" prefix. In addition, we expect to have a connection, so a BUG_ON is added to be sure the functions are never called in another context.
This commit is contained in:
parent
2f35e7b6ab
commit
69ef6c9ef4
@ -167,11 +167,13 @@ static inline const char *cs_get_data_name(const struct conn_stream *cs)
|
||||
}
|
||||
|
||||
/* shut read */
|
||||
static inline void cs_shutr(struct conn_stream *cs, enum co_shr_mode mode)
|
||||
static inline void cs_conn_shutr(struct conn_stream *cs, enum co_shr_mode mode)
|
||||
{
|
||||
const struct mux_ops *mux;
|
||||
|
||||
if (!cs_conn(cs) || cs->endp->flags & CS_EP_SHR)
|
||||
BUG_ON(!cs_conn(cs));
|
||||
|
||||
if (cs->endp->flags & CS_EP_SHR)
|
||||
return;
|
||||
|
||||
/* clean data-layer shutdown */
|
||||
@ -182,11 +184,13 @@ static inline void cs_shutr(struct conn_stream *cs, enum co_shr_mode mode)
|
||||
}
|
||||
|
||||
/* shut write */
|
||||
static inline void cs_shutw(struct conn_stream *cs, enum co_shw_mode mode)
|
||||
static inline void cs_conn_shutw(struct conn_stream *cs, enum co_shw_mode mode)
|
||||
{
|
||||
const struct mux_ops *mux;
|
||||
|
||||
if (!cs_conn(cs) || cs->endp->flags & CS_EP_SHW)
|
||||
BUG_ON(!cs_conn(cs));
|
||||
|
||||
if (cs->endp->flags & CS_EP_SHW)
|
||||
return;
|
||||
|
||||
/* clean data-layer shutdown */
|
||||
@ -197,17 +201,17 @@ static inline void cs_shutw(struct conn_stream *cs, enum co_shw_mode mode)
|
||||
}
|
||||
|
||||
/* completely close a conn_stream (but do not detach it) */
|
||||
static inline void cs_close(struct conn_stream *cs)
|
||||
static inline void cs_conn_close(struct conn_stream *cs)
|
||||
{
|
||||
cs_shutw(cs, CO_SHW_SILENT);
|
||||
cs_shutr(cs, CO_SHR_RESET);
|
||||
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_drain_and_close(struct conn_stream *cs)
|
||||
static inline void cs_conn_drain_and_close(struct conn_stream *cs)
|
||||
{
|
||||
cs_shutw(cs, CO_SHW_SILENT);
|
||||
cs_shutr(cs, CO_SHR_DRAIN);
|
||||
cs_conn_shutw(cs, CO_SHW_SILENT);
|
||||
cs_conn_shutr(cs, CO_SHR_DRAIN);
|
||||
}
|
||||
|
||||
/* sets CS_EP_ERROR or CS_EP_ERR_PENDING on the cs */
|
||||
@ -228,9 +232,11 @@ static inline void cs_set_error(struct conn_stream *cs)
|
||||
* conn_stream, NULL is returned. The output pointer is purposely marked
|
||||
* const to discourage the caller from modifying anything there.
|
||||
*/
|
||||
static inline const struct conn_stream *cs_get_first(const struct connection *conn)
|
||||
static inline const struct conn_stream *cs_conn_get_first(const struct connection *conn)
|
||||
{
|
||||
if (!conn || !conn->mux || !conn->mux->get_first_cs)
|
||||
BUG_ON(!conn || !conn->mux);
|
||||
|
||||
if (!conn->mux->get_first_cs)
|
||||
return NULL;
|
||||
return conn->mux->get_first_cs(conn);
|
||||
}
|
||||
|
||||
11
src/check.c
11
src/check.c
@ -1053,11 +1053,12 @@ static int wake_srv_chk(struct conn_stream *cs)
|
||||
/* Check complete or aborted. If connection not yet closed do it
|
||||
* now and wake the check task up to be sure the result is
|
||||
* handled ASAP. */
|
||||
cs_drain_and_close(cs);
|
||||
ret = -1;
|
||||
|
||||
if (check->wait_list.events)
|
||||
conn->mux->unsubscribe(cs, check->wait_list.events, &check->wait_list);
|
||||
if (conn) {
|
||||
cs_conn_drain_and_close(cs);
|
||||
if (check->wait_list.events)
|
||||
conn->mux->unsubscribe(cs, check->wait_list.events, &check->wait_list);
|
||||
}
|
||||
|
||||
/* We may have been scheduled to run, and the
|
||||
* I/O handler expects to have a cs, so remove
|
||||
@ -1192,7 +1193,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_drain_and_close(check->cs);
|
||||
cs_conn_drain_and_close(check->cs);
|
||||
}
|
||||
|
||||
/* TODO: must be handled by cs_detach_endp */
|
||||
|
||||
@ -314,7 +314,7 @@ int conn_si_send_proxy(struct connection *conn, unsigned int flag)
|
||||
/* If there is no mux attached to the connection, it means the
|
||||
* connection context is a conn-stream.
|
||||
*/
|
||||
cs = (conn->mux ? cs_get_first(conn) : conn->ctx);
|
||||
cs = (conn->mux ? cs_conn_get_first(conn) : conn->ctx);
|
||||
|
||||
/* The target server expects a PROXY line to be sent first.
|
||||
* If the send_proxy_ofs is negative, it corresponds to the
|
||||
@ -1006,7 +1006,7 @@ static void stream_int_shutr_conn(struct stream_interface *si)
|
||||
return;
|
||||
|
||||
if (si_oc(si)->flags & CF_SHUTW) {
|
||||
cs_close(cs);
|
||||
cs_conn_close(cs);
|
||||
cs->state = CS_ST_DIS;
|
||||
__cs_strm(cs)->conn_exp = TICK_ETERNITY;
|
||||
}
|
||||
@ -1063,7 +1063,7 @@ static void stream_int_shutw_conn(struct stream_interface *si)
|
||||
* option abortonclose. No need for the TLS layer to try to
|
||||
* emit a shutdown message.
|
||||
*/
|
||||
cs_shutw(cs, CO_SHW_SILENT);
|
||||
cs_conn_shutw(cs, CO_SHW_SILENT);
|
||||
}
|
||||
else {
|
||||
/* clean data-layer shutdown. This only happens on the
|
||||
@ -1072,7 +1072,7 @@ static void stream_int_shutw_conn(struct stream_interface *si)
|
||||
* while option abortonclose is set. We want the TLS
|
||||
* layer to try to signal it to the peer before we close.
|
||||
*/
|
||||
cs_shutw(cs, CO_SHW_NORMAL);
|
||||
cs_conn_shutw(cs, CO_SHW_NORMAL);
|
||||
|
||||
if (!(ic->flags & (CF_SHUTR|CF_DONT_READ)))
|
||||
return;
|
||||
@ -1083,7 +1083,7 @@ static void stream_int_shutw_conn(struct stream_interface *si)
|
||||
/* we may have to close a pending connection, and mark the
|
||||
* response buffer as shutr
|
||||
*/
|
||||
cs_close(cs);
|
||||
cs_conn_close(cs);
|
||||
/* fall through */
|
||||
case CS_ST_CER:
|
||||
case CS_ST_QUE:
|
||||
@ -1567,7 +1567,7 @@ static void stream_int_read0(struct stream_interface *si)
|
||||
if (cs->flags & CS_FL_NOHALF) {
|
||||
/* we want to immediately forward this close to the write side */
|
||||
/* force flag on ssl to keep stream in cache */
|
||||
cs_shutw(cs, CO_SHW_SILENT);
|
||||
cs_conn_shutw(cs, CO_SHW_SILENT);
|
||||
goto do_close;
|
||||
}
|
||||
|
||||
@ -1576,7 +1576,7 @@ static void stream_int_read0(struct stream_interface *si)
|
||||
|
||||
do_close:
|
||||
/* OK we completely close the socket here just as if we went through si_shut[rw]() */
|
||||
cs_close(cs);
|
||||
cs_conn_close(cs);
|
||||
|
||||
oc->flags &= ~CF_SHUTW_NOW;
|
||||
oc->flags |= CF_SHUTW;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user