Skip to content

Commit

Permalink
Fix: deactivate only *recent* HQ frame, not any HQ frame
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitri Tikhonov committed Oct 6, 2020
1 parent 75f54c8 commit a1630d9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/liblsquic/lsquic_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -2629,13 +2629,17 @@ frame_hq_gen_read (void *ctx, void *begin_buf, size_t len, int *fin)
struct stream_hq_frame *shf;
size_t nw, frame_sz, avail, rem;
unsigned bits;
int new;

while (p < end)
{
shf = find_cur_hq_frame(stream);
if (shf)
{
new = 0;
LSQ_DEBUG("found current HQ frame of type 0x%X at offset %"PRIu64,
shf->shf_frame_type, shf->shf_off);
}
else
{
rem = frame_std_gen_size(ctx);
Expand All @@ -2646,7 +2650,10 @@ frame_hq_gen_read (void *ctx, void *begin_buf, size_t len, int *fin)
shf = stream_activate_hq_frame(stream,
stream->sm_payload, HQFT_DATA, 0, rem);
if (shf)
{
new = 1;
goto insert;
}
else
{
/* TODO: abort connection? Handle failure somehow */
Expand All @@ -2663,7 +2670,8 @@ frame_hq_gen_read (void *ctx, void *begin_buf, size_t len, int *fin)
frame_sz = stream_hq_frame_size(shf);
if (frame_sz > (uintptr_t) (end - p))
{
stream_hq_frame_put(stream, shf);
if (new)
stream_hq_frame_put(stream, shf);
break;
}
LSQ_DEBUG("insert %zu-byte HQ frame of type 0x%X at payload "
Expand Down

0 comments on commit a1630d9

Please sign in to comment.