From e9f4301f0f9832a411878a8a23061a899e441dd6 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 19 Dec 2018 17:59:30 +0100 Subject: [PATCH] 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. --- include/proto/connection.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/proto/connection.h b/include/proto/connection.h index a7b596a50..f67465832 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) {