MINOR: mux-pt: Test conn flags instead of sedesc ones to perform a full close

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.
This commit is contained in:
Christopher Faulet 2024-04-16 08:22:36 +02:00
parent f58883002c
commit 293b8f7530

View File

@ -475,7 +475,7 @@ static void mux_pt_shutr(struct stconn *sc, enum co_shr_mode mode)
(mode == CO_SHR_DRAIN)); (mode == CO_SHR_DRAIN));
else if (mode == CO_SHR_DRAIN) else if (mode == CO_SHR_DRAIN)
conn_ctrl_drain(conn); 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); conn_full_close(conn);
TRACE_LEAVE(PT_EV_STRM_SHUT, conn, sc); 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) static void mux_pt_shutw(struct stconn *sc, enum co_shw_mode mode)
{ {
struct connection *conn = __sc_conn(sc); struct connection *conn = __sc_conn(sc);
struct mux_pt_ctx *ctx = conn->ctx;
TRACE_ENTER(PT_EV_STRM_SHUT, conn, sc); TRACE_ENTER(PT_EV_STRM_SHUT, conn, sc);
if (conn_xprt_ready(conn) && conn->xprt->shutw) if (conn_xprt_ready(conn) && conn->xprt->shutw)
conn->xprt->shutw(conn, conn->xprt_ctx, conn->xprt->shutw(conn, conn->xprt_ctx,
(mode == CO_SHW_NORMAL)); (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)); conn_sock_shutw(conn, (mode == CO_SHW_NORMAL));
else else
conn_full_close(conn); conn_full_close(conn);