]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Only one CRYPTO frame by encryption level
authorFrédéric Lécaille <flecaille@haproxy.com>
Tue, 4 Jan 2022 22:15:40 +0000 (23:15 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 7 Jan 2022 16:58:26 +0000 (17:58 +0100)
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

index 4a0085f3b1154db9d51c54d02c25350481ddfcaf..ca21b1f376b681e2e9b1bedc0fb051e8e9d518a6 100644 (file)
@@ -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;