From d4ecf948278e047bb43a43f622c57ff63af00a44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= Date: Tue, 4 Jan 2022 23:15:40 +0100 Subject: [PATCH] MINOR: quic: Only one CRYPTO frame by encryption level When receiving CRYPTO data from the TLS stack, concatenate the CRYPTO data to the first allocated CRYPTO frame if present. This reduces by one the number of handshake packets built for a connection with a standard size certificate. --- src/xprt_quic.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/xprt_quic.c b/src/xprt_quic.c index 4a0085f3b..ca21b1f37 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -994,15 +994,21 @@ static int quic_crypto_data_cpy(struct quic_enc_level *qel, if (!len) { struct quic_frame *frm; - frm = pool_alloc(pool_head_quic_frame); - if (!frm) - return 0; + if (MT_LIST_ISEMPTY(&qel->pktns->tx.frms)) { + frm = pool_alloc(pool_head_quic_frame); + if (!frm) + return 0; - frm->type = QUIC_FT_CRYPTO; - frm->crypto.offset = cf_offset; - frm->crypto.len = cf_len; - frm->crypto.qel = qel; - MT_LIST_APPEND(&qel->pktns->tx.frms, &frm->mt_list); + frm->type = QUIC_FT_CRYPTO; + frm->crypto.offset = cf_offset; + frm->crypto.len = cf_len; + frm->crypto.qel = qel; + MT_LIST_APPEND(&qel->pktns->tx.frms, &frm->mt_list); + } + else { + frm = MT_LIST_NEXT(&qel->pktns->tx.frms, struct quic_frame *, mt_list); + frm->crypto.len += cf_len; + } } return len == 0;