mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 07:37:02 +02:00
MINOR: muxes: add a "show_sd" helper to complete "show sess" dumps
This helper will be called for muxes that provide it and will be used to let the mux provide extra information about the stream attached to a stream descriptor. A line prefix is passed in argument so that the mux is free to break long lines without breaking indent. No prefix means no line breaks should be produced (e.g. for short dumps).
This commit is contained in:
parent
4e97bcc76b
commit
ce57777660
@ -400,6 +400,7 @@ struct mux_ops {
|
||||
struct stconn *(*get_first_sc)(const struct connection *); /* retrieves any valid stconn from this connection */
|
||||
void (*detach)(struct sedesc *); /* Detach an stconn from the stdesc from an outgoing connection, when the request is done */
|
||||
int (*show_fd)(struct buffer *, struct connection *); /* append some data about connection into chunk for "show fd"; returns non-zero if suspicious */
|
||||
int (*show_sd)(struct buffer *, struct sedesc *, const char *pfx); /* append some data about the mux stream into chunk for "show sess"; returns non-zero if suspicious */
|
||||
int (*subscribe)(struct stconn *sc, int event_type, struct wait_event *es); /* Subscribe <es> to events, such as "being able to send" */
|
||||
int (*unsubscribe)(struct stconn *sc, int event_type, struct wait_event *es); /* Unsubscribe <es> from events */
|
||||
int (*avail_streams)(struct connection *conn); /* Returns the number of streams still available for a connection */
|
||||
|
14
src/stream.c
14
src/stream.c
@ -3327,6 +3327,12 @@ static int stats_dump_full_strm_to_buffer(struct stconn *sc, struct stream *strm
|
||||
scf->sedesc->se, sc_ep_get(scf), scf->wait_event.events);
|
||||
|
||||
if ((conn = sc_conn(scf)) != NULL) {
|
||||
if (conn->mux && conn->mux->show_sd) {
|
||||
chunk_appendf(&trash, " ");
|
||||
conn->mux->show_sd(&trash, scf->sedesc, " ");
|
||||
chunk_appendf(&trash, "\n");
|
||||
}
|
||||
|
||||
chunk_appendf(&trash,
|
||||
" co0=%p ctrl=%s xprt=%s mux=%s data=%s target=%s:%p\n",
|
||||
conn,
|
||||
@ -3344,7 +3350,6 @@ static int stats_dump_full_strm_to_buffer(struct stconn *sc, struct stream *strm
|
||||
conn_fd(conn) >= 0 ? fdtab[conn->handle.fd].state : 0,
|
||||
conn_fd(conn) >= 0 ? !!(fdtab[conn->handle.fd].update_mask & ti->ltid_bit) : 0,
|
||||
conn_fd(conn) >= 0 ? fdtab[conn->handle.fd].thread_mask: 0);
|
||||
|
||||
}
|
||||
else if ((tmpctx = sc_appctx(scf)) != NULL) {
|
||||
chunk_appendf(&trash,
|
||||
@ -3365,6 +3370,12 @@ static int stats_dump_full_strm_to_buffer(struct stconn *sc, struct stream *strm
|
||||
scb->sedesc->se, sc_ep_get(scb), scb->wait_event.events);
|
||||
|
||||
if ((conn = sc_conn(scb)) != NULL) {
|
||||
if (conn->mux && conn->mux->show_sd) {
|
||||
chunk_appendf(&trash, " ");
|
||||
conn->mux->show_sd(&trash, scb->sedesc, " ");
|
||||
chunk_appendf(&trash, "\n");
|
||||
}
|
||||
|
||||
chunk_appendf(&trash,
|
||||
" co1=%p ctrl=%s xprt=%s mux=%s data=%s target=%s:%p\n",
|
||||
conn,
|
||||
@ -3382,7 +3393,6 @@ static int stats_dump_full_strm_to_buffer(struct stconn *sc, struct stream *strm
|
||||
conn_fd(conn) >= 0 ? fdtab[conn->handle.fd].state : 0,
|
||||
conn_fd(conn) >= 0 ? !!(fdtab[conn->handle.fd].update_mask & ti->ltid_bit) : 0,
|
||||
conn_fd(conn) >= 0 ? fdtab[conn->handle.fd].thread_mask: 0);
|
||||
|
||||
}
|
||||
else if ((tmpctx = sc_appctx(scb)) != NULL) {
|
||||
chunk_appendf(&trash,
|
||||
|
Loading…
Reference in New Issue
Block a user