diff --git a/include/haproxy/connection.h b/include/haproxy/connection.h index 776a4cb51..72ba1796a 100644 --- a/include/haproxy/connection.h +++ b/include/haproxy/connection.h @@ -267,6 +267,14 @@ static inline void cs_close(struct conn_stream *cs) cs->flags = CS_FL_NONE; } +/* completely close a conn_stream after draining possibly pending data (but do not detach it) */ +static inline void cs_drain_and_close(struct conn_stream *cs) +{ + cs_shutw(cs, CS_SHW_SILENT); + cs_shutr(cs, CS_SHR_DRAIN); + 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) {