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.
return cs;
}
-/* Releases a connection previously allocated by conn_new() */
-static inline void conn_free(struct connection *conn)
+static inline void conn_force_unsubscribe(struct connection *conn)
{
- if (conn->recv_wait)
+ if (conn->recv_wait) {
conn->recv_wait->wait_reason &= ~SUB_CAN_RECV;
- if (conn->send_wait)
+ 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)
+{
+ conn_force_unsubscribe(conn);
pool_free(pool_head_connection, conn);
}
struct conn_stream *cs = __objt_cs(si->end);
struct connection *conn = cs->conn;
+ conn_force_unsubscribe(conn);
if (pool)
LIST_ADD(pool, &conn->list);