diff --git a/src/xprt_quic.c b/src/xprt_quic.c index f76634f5b..a7e45f72e 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -4756,17 +4756,18 @@ static int quic_ack_frm_reduce_sz(struct quic_frame *ack_frm, size_t limit) return 1 + ack_delay_sz + ack_frm->tx_ack.arngs->enc_sz; } -/* Prepare as most as possible CRYPTO or STREAM frames from their prebuilt frames - * for encryption level to be encoded in a buffer with as available room, - * and <*len> the packet Length field initialized with the number of bytes already present - * in this buffer which must be taken into an account for the Length packet field value. - * is the number of bytes already present in this packet before building frames. +/* Prepare into as most as possible ack-eliciting frame from their + * prebuilt frames for encryption level to be encoded in a buffer + * with as available room, and <*len> the packet Length field initialized + * with the number of bytes already present in this buffer which must be taken + * into an account for the Length packet field value. is the number of + * bytes already present in this packet before building frames. * * Update consequently <*len> to reflect the size of these frames built * by this function. Also attach these frames to frame list. * Return 1 if succeeded, 0 if not. */ -static inline int qc_build_frms(struct list *l, +static inline int qc_build_frms(struct list *outlist, struct list *inlist, size_t room, size_t *len, size_t headlen, struct quic_enc_level *qel, struct quic_conn *qc) @@ -4792,7 +4793,7 @@ static inline int qc_build_frms(struct list *l, TRACE_PROTO("************** frames build (headlen)", QUIC_EV_CONN_BCFRMS, qc, &headlen); - list_for_each_entry_safe(cf, cfbak, &qel->pktns->tx.frms, list) { + list_for_each_entry_safe(cf, cfbak, inlist, list) { /* header length, data length, frame length. */ size_t hlen, dlen, dlen_sz, avail_room, flen; @@ -4824,7 +4825,7 @@ static inline int qc_build_frms(struct list *l, if (dlen == cf->crypto.len) { /* CRYPTO data have been consumed. */ LIST_DELETE(&cf->list); - LIST_APPEND(l, &cf->list); + LIST_APPEND(outlist, &cf->list); } else { struct quic_frame *new_cf; @@ -4839,7 +4840,7 @@ static inline int qc_build_frms(struct list *l, new_cf->crypto.len = dlen; new_cf->crypto.offset = cf->crypto.offset; new_cf->crypto.qel = qel; - LIST_APPEND(l, &new_cf->list); + LIST_APPEND(outlist, &new_cf->list); /* Consume bytes of the current frame. */ cf->crypto.len -= dlen; cf->crypto.offset += dlen; @@ -4887,7 +4888,7 @@ static inline int qc_build_frms(struct list *l, if (dlen == cf->stream.len) { /* STREAM data have been consumed. */ LIST_DELETE(&cf->list); - LIST_APPEND(l, &cf->list); + LIST_APPEND(outlist, &cf->list); } else { struct quic_frame *new_cf; @@ -4910,7 +4911,7 @@ static inline int qc_build_frms(struct list *l, /* FIN bit reset */ new_cf->type &= ~QUIC_STREAM_FRAME_TYPE_FIN_BIT; new_cf->stream.data = cf->stream.data; - LIST_APPEND(l, &new_cf->list); + LIST_APPEND(outlist, &new_cf->list); cf->type |= QUIC_STREAM_FRAME_TYPE_OFF_BIT; /* Consume bytes of the current frame. */ cf_buf = b_make(b_orig(cf->stream.buf), @@ -4931,7 +4932,7 @@ static inline int qc_build_frms(struct list *l, *len += flen; room -= flen; LIST_DELETE(&cf->list); - LIST_APPEND(l, &cf->list); + LIST_APPEND(outlist, &cf->list); break; } ret = 1; @@ -5038,7 +5039,8 @@ static int qc_do_build_pkt(unsigned char *pos, const unsigned char *end, * we will have len_frms > len. */ len_frms = len; - if (!qc_build_frms(&frm_list, end - pos, &len_frms, pos - beg, qel, qc)) { + if (!qc_build_frms(&frm_list, frms, + end - pos, &len_frms, pos - beg, qel, qc)) { TRACE_PROTO("Not enough room", QUIC_EV_CONN_HPKT, qc, NULL, NULL, &room); }