mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 23:56:57 +02:00
MINOR: mux-quic: count in-progress requests
Add a new qcc member named <nb_hreq>. Its purpose is close to <nb_sc> which represents the number of attached stream connectors. Both are incremented inside qc_attach_sc(). The difference is on the decrement operation. While <nb_cs> is decremented on sedesc detach callback, <nb_hreq> is decremented when the qcs is locally closed. In most cases, <nb_hreq> will be decremented before <nb_cs>. However, it will be the reverse if a stream must be kept alive after detach callback. The main purpose of this field is to implement http-keep-alive timeout. Both <nb_sc> and <nb_hreq> must be null to activate the http-keep-alive timeout.
This commit is contained in:
parent
5fc05d17ad
commit
c603de4d84
@ -33,6 +33,7 @@ enum qcs_type {
|
||||
struct qcc {
|
||||
struct connection *conn;
|
||||
uint64_t nb_sc; /* number of attached stream connectors */
|
||||
uint64_t nb_hreq; /* number of in-progress http requests */
|
||||
uint32_t flags; /* QC_CF_* */
|
||||
|
||||
struct {
|
||||
|
@ -107,6 +107,7 @@ static inline struct stconn *qc_attach_sc(struct qcs *qcs, struct buffer *buf)
|
||||
return NULL;
|
||||
|
||||
++qcc->nb_sc;
|
||||
++qcc->nb_hreq;
|
||||
|
||||
/* TODO duplicated from mux_h2 */
|
||||
sess->accept_date = date;
|
||||
|
@ -229,6 +229,20 @@ static forceinline struct stconn *qcs_sc(const struct qcs *qcs)
|
||||
return qcs->sd ? qcs->sd->sc : NULL;
|
||||
}
|
||||
|
||||
/* Decrement <qcc> sc. */
|
||||
static forceinline void qcc_rm_sc(struct qcc *qcc)
|
||||
{
|
||||
BUG_ON_HOT(!qcc->nb_sc);
|
||||
--qcc->nb_sc;
|
||||
}
|
||||
|
||||
/* Decrement <qcc> hreq. */
|
||||
static forceinline void qcc_rm_hreq(struct qcc *qcc)
|
||||
{
|
||||
BUG_ON_HOT(!qcc->nb_hreq);
|
||||
--qcc->nb_hreq;
|
||||
}
|
||||
|
||||
/* Mark a stream as open if it was idle. This can be used on every
|
||||
* successful emission/reception operation to update the stream state.
|
||||
*/
|
||||
@ -254,6 +268,7 @@ static void qcs_close_local(struct qcs *qcs)
|
||||
|
||||
if (quic_stream_is_bidi(qcs->id)) {
|
||||
qcs->st = (qcs->st == QC_SS_HREM) ? QC_SS_CLO : QC_SS_HLOC;
|
||||
qcc_rm_hreq(qcs->qcc);
|
||||
}
|
||||
else {
|
||||
/* Only local uni streams are valid for this operation. */
|
||||
@ -1780,7 +1795,7 @@ static int qc_init(struct connection *conn, struct proxy *prx,
|
||||
|
||||
qcc->conn = conn;
|
||||
conn->ctx = qcc;
|
||||
qcc->nb_sc = 0;
|
||||
qcc->nb_hreq = qcc->nb_sc = 0;
|
||||
qcc->flags = 0;
|
||||
|
||||
qcc->app_ops = NULL;
|
||||
@ -1912,7 +1927,8 @@ static void qc_detach(struct sedesc *sd)
|
||||
* BUG_ON_HOT() statement can be adjusted.
|
||||
*/
|
||||
//BUG_ON_HOT(!qcs_is_close_remote(qcs));
|
||||
--qcc->nb_sc;
|
||||
|
||||
qcc_rm_sc(qcc);
|
||||
|
||||
if (!qcs_is_close_local(qcs) && !(qcc->conn->flags & CO_FL_ERROR)) {
|
||||
TRACE_DEVEL("leaving with remaining data, detaching qcs", QMUX_EV_STRM_END, qcc->conn, qcs);
|
||||
|
Loading…
Reference in New Issue
Block a user