From: Willy Tarreau Date: Wed, 19 Dec 2018 16:59:30 +0000 (+0100) Subject: MINOR: connection: add cs_set_error() to set the error bits X-Git-Tag: v1.9.0~8 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=e9f4301f0f9832a411878a8a23061a899e441dd6;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/include/proto/connection.h b/include/proto/connection.h index a7b596a50f..f67465832e 100644 --- a/include/proto/connection.h +++ b/include/proto/connection.h @@ -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) {