MINOR: sessions: Start to store the outgoing connection in sessions.
Introduce a new field in session, "srv_conn", and a linked list of sessions
in the connection. It will be used later when we'll switch connections
from being managed by the stream, to being managed by the session.
diff --git a/include/proto/connection.h b/include/proto/connection.h
index 0b4a0d8..ade6994 100644
--- a/include/proto/connection.h
+++ b/include/proto/connection.h
@@ -558,6 +558,7 @@
conn->destroy_cb = NULL;
conn->proxy_netns = NULL;
LIST_INIT(&conn->list);
+ LIST_INIT(&conn->session_list);
conn->send_wait = NULL;
conn->recv_wait = NULL;
}
@@ -664,6 +665,13 @@
/* Releases a connection previously allocated by conn_new() */
static inline void conn_free(struct connection *conn)
{
+ struct session *sess, *sess_back;
+
+ list_for_each_entry_safe(sess, sess_back, &conn->session_list, conn_list) {
+ sess->srv_conn = NULL;
+ LIST_DEL(&sess->conn_list);
+ LIST_INIT(&sess->conn_list);
+ }
conn_force_unsubscribe(conn);
pool_free(pool_head_connection, conn);
}