]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: connection: add cs_set_error() to set the error bits
authorWilly Tarreau <w@1wt.eu>
Wed, 19 Dec 2018 16:59:30 +0000 (17:59 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 19 Dec 2018 17:13:52 +0000 (18:13 +0100)
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.

include/proto/connection.h

index a7b596a50f0fc87c1478775914b4310d61078dcf..f67465832ed91a1852895434e6592870ae77eaec 100644 (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)
 {