MINOR: quic: simplify copy of STREAM frames to RX buffer

qc_strm_cpy can be simplified by simply using b_putblk which already
handle wrapping of the destination buffer. The function is kept to
update the frame length and offset fields.
This commit is contained in:
Amaury Denoyelle 2022-02-28 10:00:54 +01:00
parent 850695ab1f
commit 2d2d030522

View File

@ -1976,22 +1976,9 @@ static size_t qc_strm_cpy(struct buffer *buf, struct quic_stream *strm_frm)
{ {
size_t ret; size_t ret;
ret = 0; ret = b_putblk(buf, (char *)strm_frm->data, strm_frm->len);
while (strm_frm->len) { strm_frm->len -= ret;
size_t try; strm_frm->offset.key += ret;
try = b_contig_space(buf);
if (!try)
break;
if (try > strm_frm->len)
try = strm_frm->len;
memcpy(b_tail(buf), strm_frm->data, try);
strm_frm->len -= try;
strm_frm->offset.key += try;
b_add(buf, try);
ret += try;
}
return ret; return ret;
} }