Skip to content

Commit 419cc6e

Browse files
committed
BUG/MINOR: mux_quic: refresh timeout only if I/O performed
Previously, QUIC MUX timeout was refreshed on every qcc_io_cb() execution. This is not desired if no send/receive were performed, as in this case the connection may be stuck. This patch fixes this by refreshing timeout only if some progress is performed during qcc_io_cb(). To implement this, return value of qcc_io_recv() has been adjusted to return the number of newly decoded bytes. This patch is considered as a bug fix as without it there is a risk of QUIC MUX inactivity timeout to be less efficient and to maintain a connection too long. This should be backported up to 2.8, after a period of observation.
1 parent b8961ee commit 419cc6e

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

src/mux_quic.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3247,12 +3247,12 @@ static void qcc_wait_for_hs(struct qcc *qcc)
32473247
/* Proceed on receiving. Loop on streams subscribed in recv_list and performed
32483248
* STREAM frames decoding upon them.
32493249
*
3250-
* Returns 0 on success else non-zero.
3250+
* Returns the number of newly transcoded bytes.
32513251
*/
32523252
static int qcc_io_recv(struct qcc *qcc)
32533253
{
32543254
struct qcs *qcs;
3255-
int ret;
3255+
int total = 0, ret;
32563256

32573257
TRACE_ENTER(QMUX_EV_QCC_RECV, qcc->conn);
32583258

@@ -3281,12 +3281,13 @@ static int qcc_io_recv(struct qcc *qcc)
32813281

32823282
if (ret <= 0)
32833283
goto done;
3284+
total += ret;
32843285
}
32853286
}
32863287

32873288
done:
32883289
TRACE_LEAVE(QMUX_EV_QCC_RECV, qcc->conn);
3289-
return 0;
3290+
return total;
32903291
}
32913292

32923293
/* Calculate the number of bidirectional streams which can still be opened for
@@ -3613,7 +3614,7 @@ struct task *qcc_io_cb(struct task *t, void *ctx, unsigned int state)
36133614
{
36143615
struct qcc *qcc = ctx;
36153616
struct connection *conn;
3616-
int conn_in_list;
3617+
int total = 0, conn_in_list;
36173618

36183619
if (state & TASK_F_USR1) {
36193620
/* the tasklet was idling on an idle connection, it might have
@@ -3661,16 +3662,17 @@ struct task *qcc_io_cb(struct task *t, void *ctx, unsigned int state)
36613662
}
36623663

36633664
if (!(qcc->wait_event.events & SUB_RETRY_SEND))
3664-
qcc_io_send(qcc);
3665+
total += qcc_io_send(qcc);
36653666

3666-
qcc_io_recv(qcc);
3667+
total += qcc_io_recv(qcc);
36673668

36683669
if (qcc_io_process(qcc)) {
36693670
TRACE_STATE("releasing dead connection", QMUX_EV_QCC_WAKE, conn);
36703671
goto release;
36713672
}
36723673

3673-
qcc_refresh_timeout(qcc);
3674+
if (total)
3675+
qcc_refresh_timeout(qcc);
36743676

36753677
/* Trigger pacing task is emission should be retried after some delay. */
36763678
if (qcc_is_pacing_active(conn)) {

0 commit comments

Comments
 (0)