CLEANUP: connection: do not use conn->owner when the session is known
At a few places we used to rely on conn->owner to retrieve the session
while the session is already known. This is not correct because at some
of these points the reason the connection's owner was still the session
(instead of NULL) is a mistake. At one place a comparison is even made
between the session and conn->owner assuming it's valid without checking
if it's NULL. Let's clean this up to use the session all the time.
Note that this will be needed for a forthcoming fix and will have to be
backported.
(cherry picked from commit 38b4d2eb22fec0f11af50f8a9977ccae0e7c66c6)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/connection.c b/src/connection.c
index dc54b9d..366bb25 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -54,10 +54,10 @@
goto fail;
if (sess && obj_type(sess->origin) == OBJ_TYPE_CHECK) {
- if (conn_install_mux_chk(conn, conn->ctx, conn->owner) < 0)
+ if (conn_install_mux_chk(conn, conn->ctx, sess) < 0)
goto fail;
}
- else if (conn_install_mux_be(conn, conn->ctx, conn->owner) < 0)
+ else if (conn_install_mux_be(conn, conn->ctx, sess) < 0)
goto fail;
srv = objt_server(conn->target);
@@ -72,7 +72,7 @@
LIST_ADDQ(&srv->available_conns[tid], mt_list_to_list(&conn->list));
else if (conn->flags & CO_FL_PRIVATE) {
/* If it fail now, the same will be done in mux->detach() callback */
- session_add_conn(conn->owner, conn, conn->target);
+ session_add_conn(sess, conn, conn->target);
}
return 0;
fail: