MINOR: quic: notify the mux on CONNECTION_CLOSE

The xprt layer is reponsible to notify the mux of a CONNECTION_CLOSE
reception. In this case the flag QC_CF_CC_RECV is positionned on the
qcc and the mux tasklet is waken up.

One of the notable effect of the QC_CF_CC_RECV is that each qcs will be
released even if they have remaining data in their send buffers.
This commit is contained in:
Amaury Denoyelle 2021-12-08 14:51:04 +01:00
parent 2873a31c81
commit 5154e7a252
3 changed files with 10 additions and 4 deletions

View File

@ -22,9 +22,11 @@ enum qcs_type {
QCS_MAX_TYPES
};
#define QC_CF_CC_RECV 0x00000001
struct qcc {
struct connection *conn;
uint32_t flags;
uint32_t flags; /* QC_CF_* */
struct {
uint64_t max_streams; /* maximum number of concurrent streams */

View File

@ -275,7 +275,8 @@ static int qc_release_detached_streams(struct qcc *qcc)
node = eb64_next(node);
if (qcs->flags & QC_SF_DETACH) {
if (!b_data(&qcs->tx.buf) && !b_data(&qcs->tx.xprt_buf)) {
if ((!b_data(&qcs->tx.buf) && !b_data(&qcs->tx.xprt_buf)) ||
qcc->flags & QC_CF_CC_RECV) {
qcs_destroy(qcs);
release = 1;
}
@ -360,7 +361,8 @@ static void qc_detach(struct conn_stream *cs)
fprintf(stderr, "%s: leaving with tx.buf.data=%lu, tx.xprt_buf.data=%lu\n",
__func__, b_data(&qcs->tx.buf), b_data(&qcs->tx.xprt_buf));
if (b_data(&qcs->tx.buf) || b_data(&qcs->tx.xprt_buf)) {
if ((b_data(&qcs->tx.buf) || b_data(&qcs->tx.xprt_buf)) &&
!(qcc->flags & QC_CF_CC_RECV)) {
qcs->flags |= QC_SF_DETACH;
return;
}

View File

@ -2326,7 +2326,9 @@ static int qc_parse_pkt_frms(struct quic_rx_packet *pkt, struct ssl_sock_ctx *ct
break;
case QUIC_FT_CONNECTION_CLOSE:
case QUIC_FT_CONNECTION_CLOSE_APP:
/* TODO warn the mux to close the connection */
/* warn the mux to close the connection */
conn->qcc->flags |= QC_CF_CC_RECV;
tasklet_wakeup(conn->qcc->wait_event.tasklet);
break;
case QUIC_FT_HANDSHAKE_DONE:
if (objt_listener(ctx->conn->target))