From 22050e0a2cdae2fd20f92ebc4124e4024ef0e095 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Wed, 13 Apr 2022 12:08:09 +0200 Subject: [PATCH] MINOR: muxes: Improve show_fd callbacks to dump endpoint flags H1, H2 and FCGI multiplexers define a show_fd callback to dump some internal info. The stream endpoint and its flags are now dumped if it exists. --- src/mux_fcgi.c | 9 ++++++--- src/mux_h1.c | 14 ++++++++------ src/mux_h2.c | 5 +++++ 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/mux_fcgi.c b/src/mux_fcgi.c index 33b69a2e2..56a9a0bd0 100644 --- a/src/mux_fcgi.c +++ b/src/mux_fcgi.c @@ -4189,9 +4189,12 @@ static int fcgi_show_fd(struct buffer *msg, struct connection *conn) (unsigned int)b_data(&fstrm->rxbuf), b_orig(&fstrm->rxbuf), (unsigned int)b_head_ofs(&fstrm->rxbuf), (unsigned int)b_size(&fstrm->rxbuf), fstrm->cs); - if (fstrm->cs) - chunk_appendf(msg, " .cs.flg=0x%08x .cs.app=%p", - fstrm->cs->flags, fstrm->cs->app); + if (fstrm->endp) { + chunk_appendf(msg, " .endp.flg=0x%08x", fstrm->endp->flags); + if (!(fstrm->endp->flags & CS_EP_ORPHAN)) + chunk_appendf(msg, " .cs.flg=0x%08x .cs.app=%p", + fstrm->cs->flags, fstrm->cs->app); + } chunk_appendf(&trash, " .subs=%p", fstrm->subs); if (fstrm->subs) { chunk_appendf(&trash, "(ev=%d tl=%p", fstrm->subs->events, fstrm->subs->tasklet); diff --git a/src/mux_h1.c b/src/mux_h1.c index 6bfb69bc2..851967edc 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -3889,15 +3889,17 @@ static int h1_show_fd(struct buffer *msg, struct connection *conn) method = http_known_methods[h1s->meth].ptr; else method = "UNKNOWN"; - chunk_appendf(msg, " h1s=%p h1s.flg=0x%x .req.state=%s .res.state=%s" + chunk_appendf(msg, " h1s=%p h1s.flg=0x%x .endp.flg=0x%x .req.state=%s .res.state=%s" " .meth=%s status=%d", - h1s, h1s->flags, + h1s, h1s->flags, h1s->endp->flags, h1m_state_str(h1s->req.state), h1m_state_str(h1s->res.state), method, h1s->status); - if (h1s->cs) - chunk_appendf(msg, " .cs.flg=0x%08x .cs.app=%p", - h1s->cs->flags, h1s->cs->app); - + if (h1s->endp) { + chunk_appendf(msg, " .endp.flg=0x%08x", h1s->endp->flags); + if (!(h1s->endp->flags & CS_EP_ORPHAN)) + chunk_appendf(msg, " .cs.flg=0x%08x .cs.app=%p", + h1s->cs->flags, h1s->cs->app); + } chunk_appendf(&trash, " .subs=%p", h1s->subs); if (h1s->subs) { chunk_appendf(&trash, "(ev=%d tl=%p", h1s->subs->events, h1s->subs->tasklet); diff --git a/src/mux_h2.c b/src/mux_h2.c index 71327b86b..3b321d5e2 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -6744,6 +6744,11 @@ static int h2_show_fd(struct buffer *msg, struct connection *conn) chunk_appendf(msg, "(.flg=0x%08x .app=%p)", h2s->cs->flags, h2s->cs->app); + chunk_appendf(msg, "endp=%p", h2s->endp); + if (h2s->endp) + chunk_appendf(msg, "(.flg=0x%08x)", + h2s->endp->flags); + chunk_appendf(&trash, " .subs=%p", h2s->subs); if (h2s->subs) { chunk_appendf(&trash, "(ev=%d tl=%p", h2s->subs->events, h2s->subs->tasklet);