]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-pt: Test conn flags instead of sedesc ones to perform a full close
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 16 Apr 2024 06:22:36 +0000 (08:22 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 19 Apr 2024 13:34:27 +0000 (15:34 +0200)
In .shutr and .shutw callback functions, we must rely on the connection
flags (CO_FL_SOCK_RD_SH/WR_SH) to decide to fully close the connection
instead of using sedesc flags. At the end, for the PT multiplexer, it is
equivalent. But it is more logicial and consistent this way.

src/mux_pt.c

index 832d189803a042b27955130ac924e02324fef162..77fd9897d152e0407dfa62b3216fb9b84d9261d8 100644 (file)
@@ -475,7 +475,7 @@ static void mux_pt_shutr(struct stconn *sc, enum co_shr_mode mode)
                    (mode == CO_SHR_DRAIN));
        else if (mode == CO_SHR_DRAIN)
                conn_ctrl_drain(conn);
-       if (se_fl_test(ctx->sd, SE_FL_SHW))
+       if (conn->flags & CO_FL_SOCK_WR_SH)
                conn_full_close(conn);
 
        TRACE_LEAVE(PT_EV_STRM_SHUT, conn, sc);
@@ -484,14 +484,13 @@ static void mux_pt_shutr(struct stconn *sc, enum co_shr_mode mode)
 static void mux_pt_shutw(struct stconn *sc, enum co_shw_mode mode)
 {
        struct connection *conn = __sc_conn(sc);
-       struct mux_pt_ctx *ctx = conn->ctx;
 
        TRACE_ENTER(PT_EV_STRM_SHUT, conn, sc);
 
        if (conn_xprt_ready(conn) && conn->xprt->shutw)
                conn->xprt->shutw(conn, conn->xprt_ctx,
                    (mode == CO_SHW_NORMAL));
-       if (!se_fl_test(ctx->sd, SE_FL_SHR))
+       if (!(conn->flags & CO_FL_SOCK_RD_SH))
                conn_sock_shutw(conn, (mode == CO_SHW_NORMAL));
        else
                conn_full_close(conn);