MINOR: connection: add cs_set_error() to set the error bits

Depending on the CS_FL_EOS status, we either set CS_FL_ERR_PENDING
or CS_FL_ERROR at various places. Let's have a generic function to
do this.
This commit is contained in:
Willy Tarreau 2018-12-19 17:59:30 +01:00
parent f830f018cf
commit e9f4301f0f

View File

@ -501,6 +501,15 @@ static inline void cs_close(struct conn_stream *cs)
cs->flags = CS_FL_NONE;
}
/* sets CS_FL_ERROR or CS_FL_ERR_PENDING on the cs */
static inline void cs_set_error(struct conn_stream *cs)
{
if (cs->flags & CS_FL_EOS)
cs->flags |= CS_FL_ERROR;
else
cs->flags |= CS_FL_REOS | CS_FL_ERR_PENDING;
}
/* detect sock->data read0 transition */
static inline int conn_xprt_read0_pending(struct connection *c)
{