mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 15:17:01 +02:00
BUG/MEDIUM: connections: Remove subscription if going in idle mode.
Make sure we don't have any subscription when the connection is going in idle mode, otherwise there's a race condition when the connection is reused, if there are still old subscriptions, new ones won't be done. No backport is needed.
This commit is contained in:
parent
52b946686c
commit
1fddc9b7bb
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user