}
}
+static int fcgi_sctl(struct stconn *sc, enum mux_sctl_type mux_sctl, void *output)
+{
+ int ret = 0;
+ struct fcgi_strm *fstrm = __sc_mux_strm(sc);
+
+ switch (mux_sctl) {
+ case MUX_SCTL_SID:
+ if (output)
+ *((int64_t *)output) = fstrm->id;
+ return ret;
+
+ default:
+ return -1;
+ }
+}
+
/* Connection timeout management. The principle is that if there's no receipt
* nor sending for a certain amount of time, the connection is closed. If the
* MUX buffer still has lying data or is not allocatable, the connection is
.shutr = fcgi_shutr,
.shutw = fcgi_shutw,
.ctl = fcgi_ctl,
+ .sctl = fcgi_sctl,
.show_fd = fcgi_show_fd,
.takeover = fcgi_takeover,
.flags = MX_FL_HTX|MX_FL_HOL_RISK|MX_FL_NO_UPG,
int timeout; /* client/server timeout duration */
int shut_timeout; /* client-fin/server-fin timeout duration */
+ unsigned int req_count; /* The number of requests handled by this H1 connection */
+
struct h1_counters *px_counters; /* h1 counters attached to proxy */
struct buffer_wait buf_wait; /* Wait list for buffer allocation */
struct wait_event wait_event; /* To be used if we're waiting for I/Os */
h1s->req.state == H1_MSG_DONE && h1s->res.state == H1_MSG_DONE) { /* req/res in DONE state */
h1c->state = H1_CS_IDLE;
h1c->flags |= H1C_F_WAIT_NEXT_REQ;
+ h1c->req_count++;
TRACE_STATE("set idle mode on h1c, waiting for the next request", H1_EV_H1C_ERR, h1c->conn, h1s);
}
else {
h1c->obuf = BUF_NULL;
h1c->h1s = NULL;
h1c->task = NULL;
+ h1c->req_count = 0;
LIST_INIT(&h1c->buf_wait.list);
h1c->wait_event.tasklet = tasklet_new();
}
}
+static int h1_sctl(struct stconn *sc, enum mux_sctl_type mux_sctl, void *output)
+{
+ int ret = 0;
+ struct h1s *h1s = __sc_mux_strm(sc);
+
+ switch (mux_sctl) {
+ case MUX_SCTL_SID:
+ if (output)
+ *((int64_t *)output) = h1s->h1c->req_count;
+ return ret;
+
+ default:
+ return -1;
+ }
+}
+
/* appends some info about connection <h1c> to buffer <msg>, or does nothing if
* <h1c> is NULL. Returns non-zero if the connection is considered suspicious.
* May emit multiple lines, each new one being prefixed with <pfx>, if <pfx> is
.show_fd = h1_show_fd,
.show_sd = h1_show_sd,
.ctl = h1_ctl,
+ .sctl = h1_sctl,
.takeover = h1_takeover,
.flags = MX_FL_HTX,
.name = "H1",
.show_fd = h1_show_fd,
.show_sd = h1_show_sd,
.ctl = h1_ctl,
+ .sctl = h1_sctl,
.takeover = h1_takeover,
.flags = MX_FL_HTX|MX_FL_NO_UPG,
.name = "H1",
}
}
+static int h2_sctl(struct stconn *sc, enum mux_sctl_type mux_sctl, void *output)
+{
+ int ret = 0;
+ struct h2s *h2s = __sc_mux_strm(sc);
+
+ switch (mux_sctl) {
+ case MUX_SCTL_SID:
+ if (output)
+ *((int64_t *)output) = h2s->id;
+ return ret;
+
+ default:
+ return -1;
+ }
+}
+
/*
* Destroy the mux and the associated connection, if it is no longer used
*/
.shutr = h2_shutr,
.shutw = h2_shutw,
.ctl = h2_ctl,
+ .sctl = h2_sctl,
.show_fd = h2_show_fd,
.show_sd = h2_show_sd,
.takeover = h2_takeover,
}
}
+static int mux_pt_sctl(struct stconn *sc, enum mux_sctl_type mux_sctl, void *output)
+{
+ int ret = 0;
+
+ switch (mux_sctl) {
+ case MUX_SCTL_SID:
+ if (output)
+ *((int64_t *)output) = 0;
+ return ret;
+
+ default:
+ return -1;
+ }
+}
+
/* The mux operations */
const struct mux_ops mux_tcp_ops = {
.init = mux_pt_init,
.used_streams = mux_pt_used_streams,
.destroy = mux_pt_destroy_meth,
.ctl = mux_pt_ctl,
+ .sctl = mux_pt_sctl,
.shutr = mux_pt_shutr,
.shutw = mux_pt_shutw,
.flags = MX_FL_NONE,
.used_streams = mux_pt_used_streams,
.destroy = mux_pt_destroy_meth,
.ctl = mux_pt_ctl,
+ .sctl = mux_pt_sctl,
.shutr = mux_pt_shutr,
.shutw = mux_pt_shutw,
.flags = MX_FL_NONE|MX_FL_NO_UPG,
TRACE_LEAVE(QMUX_EV_STRM_SHUT, qcc->conn, qcs);
}
+static int qmux_sctl(struct stconn *sc, enum mux_sctl_type mux_sctl, void *output)
+{
+ int ret = 0;
+ struct qcs *qcs = __sc_mux_strm(sc);
+
+ switch (mux_sctl) {
+ case MUX_SCTL_SID:
+ if (output)
+ *((int64_t *)output) = qcs->id;
+ return ret;
+
+ default:
+ return -1;
+ }
+}
+
/* for debugging with CLI's "show sess" command. May emit multiple lines, each
* new one being prefixed with <pfx>, if <pfx> is not NULL, otherwise a single
* line is used. Each field starts with a space so it's safe to print it after
.unsubscribe = qmux_strm_unsubscribe,
.wake = qmux_wake,
.shutw = qmux_strm_shutw,
+ .sctl = qmux_sctl,
.show_sd = qmux_strm_show_sd,
.flags = MX_FL_HTX|MX_FL_NO_UPG|MX_FL_FRAMED,
.name = "QUIC",