From 7b638eb1a6fb8ce4148f075141d49ed7a55dcfd7 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Tue, 4 Feb 2025 11:54:05 +0100 Subject: [PATCH] MINOR: mux-spop: Implement .show_sd callback function The SPOP multiplexer now implements the .show_sd callback function called by "show sess" CLI command. --- src/mux_spop.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/mux_spop.c b/src/mux_spop.c index 488d3cae2..4667f6c27 100644 --- a/src/mux_spop.c +++ b/src/mux_spop.c @@ -3502,6 +3502,28 @@ static int spop_show_fd(struct buffer *msg, struct connection *conn) return ret; } +/* for debugging with CLI's "show sess" command. May emit multiple lines, each + * new one being prefixed with , if is not NULL, otherwise a single + * line is used. Each field starts with a space so it's safe to print it after + * existing fields. + */ +static int spop_show_sd(struct buffer *msg, struct sedesc *sd, const char *pfx) +{ + struct spop_strm *spop_strm = sd->se; + int ret = 0; + + if (!spop_strm) + return ret; + + chunk_appendf(msg, " spop_strm=%p", spop_strm); + ret |= spop_dump_spop_strm_info(msg, spop_strm, pfx); + if (pfx) + chunk_appendf(msg, "\n%s", pfx); + chunk_appendf(msg, " spop_conn=%p", spop_strm->spop_conn); + ret |= spop_dump_spop_conn_info(msg, spop_strm->spop_conn, pfx); + return ret; +} + /* Migrate the the connection to the current thread. * Return 0 if successful, non-zero otherwise. * Expected to be called with the old thread lock held. @@ -3622,6 +3644,7 @@ static const struct mux_ops mux_spop_ops = { .ctl = spop_ctl, .sctl = spop_sctl, .show_fd = spop_show_fd, + .show_sd = spop_show_sd, .takeover = spop_takeover, .flags = MX_FL_HOL_RISK|MX_FL_NO_UPG, .name = "SPOP",