Skip to content
Snippets Groups Projects
Commit f831ed89 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont Committed by Hugo Beauzée-Luyssen
Browse files

http: account for queue in congestion window

The code would credit the congestion window whenever the server had
consumed half of the credits. If the client read data slower than the
server sent it, it would lead to arbitrarily large queues.

To avoid this, only credit the congestion window when the client has
read half the data.

Fixes #26082.
parent 113e98f6
No related branches found
No related tags found
1 merge request!593http: account for queue in congestion window
Pipeline #136456 passed with stage
in 11 minutes and 38 seconds
......@@ -184,7 +184,6 @@ static int vlc_h2_stream_data(void *ctx, struct vlc_h2_frame *f)
free(f);
return vlc_h2_stream_fatal(s, VLC_H2_FLOW_CONTROL_ERROR);
}
s->recv_cwnd -= len;
*(s->recv_tailp) = f;
s->recv_tailp = &f->next;
......@@ -416,6 +415,12 @@ static block_t *vlc_h2_stream_read(struct vlc_http_stream *stream)
s->recv_tailp = &s->recv_head;
}
size_t len;
uint8_t *buf = vlc_h2_frame_data_get(f, &len);
assert(s->recv_cwnd >= len);
s->recv_cwnd -= len;
/* Credit the receive window if missing credit exceeds 50%. */
uint_fast32_t credit = VLC_H2_INIT_WINDOW - s->recv_cwnd;
if (credit >= (VLC_H2_INIT_WINDOW / 2)
......@@ -432,9 +437,6 @@ static block_t *vlc_h2_stream_read(struct vlc_http_stream *stream)
return vlc_http_error;
}
size_t len;
uint8_t *buf = vlc_h2_frame_data_get(f, &len);
assert(block->i_buffer >= len);
assert(block->p_buffer <= buf);
assert(block->p_buffer + block->i_buffer >= buf + len);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment