MINOR: muxes: Add ctl commands to get info on streams for a connection
There are 2 new ctl commands that may be used to retrieve the current number of streams openned for a connection and its limit (the maximum number of streams a mux connection supports). For the PT and H1 muxes, the limit is always 1 and the current number of streams is 0 for idle connections, otherwise 1 is returned. For the H2 and the FCGI muxes, info are already available in the mux connection. For the QUIC mux, the limit is also directly available. It is the maximum initial sub-ID of bidirectional stream allowed for the connection. For the current number of streams, it is the number of SC attached on the connection and the number of not already attached streams present in the "opening_list" list.
This commit is contained in:
parent
12fb6d73cd
commit
eca9831ec8
@ -323,6 +323,8 @@ enum mux_ctl_type {
|
||||
MUX_CTL_REVERSE_CONN, /* Notify about an active reverse connection accepted. */
|
||||
MUX_CTL_SUBS_RECV, /* Notify the mux it must wait for read events again */
|
||||
MUX_CTL_GET_GLITCHES, /* returns number of glitches on the connection */
|
||||
MUX_CTL_GET_NBSTRM, /* Return the current number of streams on the connection */
|
||||
MUX_CTL_GET_MAXSTRM, /* Return the max number of streams supported by the connection */
|
||||
};
|
||||
|
||||
/* sctl command used by mux->sctl() */
|
||||
|
@ -3089,7 +3089,9 @@ static int fcgi_wake(struct connection *conn)
|
||||
|
||||
static int fcgi_ctl(struct connection *conn, enum mux_ctl_type mux_ctl, void *output)
|
||||
{
|
||||
struct fcgi_conn *fconn = conn->ctx;
|
||||
int ret = 0;
|
||||
|
||||
switch (mux_ctl) {
|
||||
case MUX_CTL_STATUS:
|
||||
if (!(conn->flags & CO_FL_WAIT_XPRT))
|
||||
@ -3097,6 +3099,10 @@ static int fcgi_ctl(struct connection *conn, enum mux_ctl_type mux_ctl, void *ou
|
||||
return ret;
|
||||
case MUX_CTL_EXIT_STATUS:
|
||||
return MUX_ES_UNKNOWN;
|
||||
case MUX_CTL_GET_NBSTRM:
|
||||
return fconn->nb_streams;
|
||||
case MUX_CTL_GET_MAXSTRM:
|
||||
return fconn->streams_limit;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
@ -5025,6 +5025,10 @@ static int h1_ctl(struct connection *conn, enum mux_ctl_type mux_ctl, void *outp
|
||||
if (!(h1c->wait_event.events & SUB_RETRY_RECV))
|
||||
h1c->conn->xprt->subscribe(h1c->conn, h1c->conn->xprt_ctx, SUB_RETRY_RECV, &h1c->wait_event);
|
||||
return 0;
|
||||
case MUX_CTL_GET_NBSTRM:
|
||||
return h1_used_streams(conn);
|
||||
case MUX_CTL_GET_MAXSTRM:
|
||||
return 1;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
@ -4729,6 +4729,12 @@ static int h2_ctl(struct connection *conn, enum mux_ctl_type mux_ctl, void *outp
|
||||
case MUX_CTL_GET_GLITCHES:
|
||||
return h2c->glitches;
|
||||
|
||||
case MUX_CTL_GET_NBSTRM:
|
||||
return h2c->nb_streams;
|
||||
|
||||
case MUX_CTL_GET_MAXSTRM:
|
||||
return h2c->streams_limit;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
@ -781,6 +781,7 @@ static int mux_pt_unsubscribe(struct stconn *sc, int event_type, struct wait_eve
|
||||
static int mux_pt_ctl(struct connection *conn, enum mux_ctl_type mux_ctl, void *output)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
switch (mux_ctl) {
|
||||
case MUX_CTL_STATUS:
|
||||
if (!(conn->flags & CO_FL_WAIT_XPRT))
|
||||
@ -788,6 +789,10 @@ static int mux_pt_ctl(struct connection *conn, enum mux_ctl_type mux_ctl, void *
|
||||
return ret;
|
||||
case MUX_CTL_EXIT_STATUS:
|
||||
return MUX_ES_UNKNOWN;
|
||||
case MUX_CTL_GET_NBSTRM:
|
||||
return mux_pt_used_streams(conn);
|
||||
case MUX_CTL_GET_MAXSTRM:
|
||||
return 1;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
@ -3144,6 +3144,18 @@ static int qmux_ctl(struct connection *conn, enum mux_ctl_type mux_ctl, void *ou
|
||||
case MUX_CTL_EXIT_STATUS:
|
||||
return MUX_ES_UNKNOWN;
|
||||
|
||||
case MUX_CTL_GET_NBSTRM: {
|
||||
struct qcs *qcs;
|
||||
unsigned int nb_strm = qcc->nb_sc;
|
||||
|
||||
list_for_each_entry(qcs, &qcc->opening_list, el_opening)
|
||||
nb_strm++;
|
||||
return nb_strm;
|
||||
}
|
||||
|
||||
case MUX_CTL_GET_MAXSTRM:
|
||||
return qcc->lfctl.ms_bidi_init;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user