diff --git a/include/proto/connection.h b/include/proto/connection.h index 2d4c4c73d..90c4fddee 100644 --- a/include/proto/connection.h +++ b/include/proto/connection.h @@ -701,13 +701,23 @@ static inline struct conn_stream *cs_new(struct connection *conn) return cs; } +static inline void conn_force_unsubscribe(struct connection *conn) +{ + if (conn->recv_wait) { + conn->recv_wait->wait_reason &= ~SUB_CAN_RECV; + conn->recv_wait = NULL; + } + if (conn->send_wait) { + conn->send_wait->wait_reason &= ~SUB_CAN_SEND; + conn->send_wait = NULL; + } + +} + /* Releases a connection previously allocated by conn_new() */ static inline void conn_free(struct connection *conn) { - if (conn->recv_wait) - conn->recv_wait->wait_reason &= ~SUB_CAN_RECV; - if (conn->send_wait) - conn->send_wait->wait_reason &= ~SUB_CAN_SEND; + conn_force_unsubscribe(conn); pool_free(pool_head_connection, conn); } diff --git a/include/proto/stream_interface.h b/include/proto/stream_interface.h index 95a8e2317..7860c79c8 100644 --- a/include/proto/stream_interface.h +++ b/include/proto/stream_interface.h @@ -194,6 +194,7 @@ static inline void si_idle_cs(struct stream_interface *si, struct list *pool) struct conn_stream *cs = __objt_cs(si->end); struct connection *conn = cs->conn; + conn_force_unsubscribe(conn); if (pool) LIST_ADD(pool, &conn->list);