diff --git a/lib/ngtcp2_conn.c b/lib/ngtcp2_conn.c index 12c0b9db5e87e5018943020e5c8dd9ded0855be4..909648079c074174db365dfe461fd74e290731b4 100644 --- a/lib/ngtcp2_conn.c +++ b/lib/ngtcp2_conn.c @@ -1490,6 +1490,7 @@ static int conn_cryptofrq_unacked_pop(ngtcp2_conn *conn, ngtcp2_pktns *pktns, } nfr = &nfrc->fr.crypto; + nfr->type = NGTCP2_FRAME_CRYPTO; memcpy(nfr->data, fr->data + end_idx, sizeof(nfr->data[0]) * (fr->datacnt - end_idx)); diff --git a/lib/ngtcp2_strm.c b/lib/ngtcp2_strm.c index 7c46d9b64711106292db5ba6fcd8855a9ca9438e..6fb73dc0727b5f065a343fac6ae501526e8482bf 100644 --- a/lib/ngtcp2_strm.c +++ b/lib/ngtcp2_strm.c @@ -228,19 +228,12 @@ static int strm_streamfrq_unacked_pop(ngtcp2_strm *strm, return 0; } - rv = ngtcp2_frame_chain_new(&nfrc, strm->mem); - if (rv != 0) { - ngtcp2_frame_chain_del(frc, strm->mem); - return rv; - } + fr->offset = fr->offset + ngtcp2_vec_len(fr->data, fr->datacnt); + fr->datacnt = 0; - nfr = &nfrc->fr.stream; - nfr->fin = 1; - nfr->stream_id = fr->stream_id; - nfr->offset = fr->offset + ngtcp2_vec_len(fr->data, fr->datacnt); - nfr->datacnt = 0; + *pfrc = frc; - *pfrc = nfrc; + return 0; } ngtcp2_frame_chain_del(frc, strm->mem); continue; @@ -294,6 +287,7 @@ static int strm_streamfrq_unacked_pop(ngtcp2_strm *strm, assert(nfr->data[0].len > end_base_offset); + nfr->type = NGTCP2_FRAME_STREAM; nfr->flags = 0; nfr->fin = fr->fin; nfr->stream_id = fr->stream_id; diff --git a/tests/ngtcp2_strm_test.c b/tests/ngtcp2_strm_test.c index 8d2d23d2adbc1792ed30a378f5b160d2e6734835..3c340a98b06c4abfd82dbfbb566a05b102a85b99 100644 --- a/tests/ngtcp2_strm_test.c +++ b/tests/ngtcp2_strm_test.c @@ -505,6 +505,7 @@ void test_ngtcp2_strm_streamfrq_unacked_pop(void) { rv = ngtcp2_strm_streamfrq_pop(&strm, &frc, 1024); CU_ASSERT(0 == rv); + CU_ASSERT(NGTCP2_FRAME_STREAM == frc->fr.type); CU_ASSERT(1 == frc->fr.stream.fin); CU_ASSERT(764 == frc->fr.stream.offset); CU_ASSERT(0 == ngtcp2_vec_len(frc->fr.stream.data, frc->fr.stream.datacnt)); @@ -520,6 +521,7 @@ void test_ngtcp2_strm_streamfrq_unacked_pop(void) { rv = ngtcp2_strm_streamfrq_pop(&strm, &frc, 43); CU_ASSERT(0 == rv); + CU_ASSERT(NGTCP2_FRAME_STREAM == frc->fr.type); CU_ASSERT(0 == frc->fr.stream.fin); CU_ASSERT(12 == frc->fr.stream.offset); CU_ASSERT(1 == frc->fr.stream.datacnt); @@ -536,6 +538,7 @@ void test_ngtcp2_strm_streamfrq_unacked_pop(void) { rv = ngtcp2_strm_streamfrq_pop(&strm, &frc, 43); CU_ASSERT(0 == rv); + CU_ASSERT(NGTCP2_FRAME_STREAM == frc->fr.type); CU_ASSERT(0 == frc->fr.stream.fin); CU_ASSERT(0 == frc->fr.stream.offset); CU_ASSERT(2 == frc->fr.stream.datacnt);