MINOR: connection: add cs_close() to close a conn_stream

This basically calls cs_shutw() followed by cs_shutr(). Both of them
are called in the most conservative mode so that any previous call is
still respected. The CS flags are cleared so that it can be reused
(this is important for connection retries when conn and CS are reused
without being reallocated).
This commit is contained in:
Willy Tarreau 2017-10-05 18:19:43 +02:00
parent 9fbbff6de4
commit 6978db35e9
1 changed files with 8 additions and 0 deletions

View File

@ -559,6 +559,14 @@ static inline void cs_shutw(struct conn_stream *cs, enum cs_shw_mode mode)
cs->flags |= (mode == CS_SHW_NORMAL) ? CS_FL_SHWN : CS_FL_SHWS;
}
/* completely close a conn_stream (but do not detach it) */
static inline void cs_close(struct conn_stream *cs)
{
cs_shutw(cs, CS_SHW_SILENT);
cs_shutr(cs, CS_SHR_RESET);
cs->flags = CS_FL_NONE;
}
/* detect sock->data read0 transition */
static inline int conn_xprt_read0_pending(struct connection *c)
{