[vlc-commits] [Git][videolan/vlc][master] http: account for queue in congestion window

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Sep 10 08:48:55 UTC 2021



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
f831ed89 by RĂ©mi Denis-Courmont at 2021-09-10T08:06:08+00:00
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.

- - - - -


1 changed file:

- modules/access/http/h2conn.c


Changes:

=====================================
modules/access/http/h2conn.c
=====================================
@@ -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);



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/f831ed899c4d2d3af15ad8ff706cae3f6c98fb2a

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/f831ed899c4d2d3af15ad8ff706cae3f6c98fb2a
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list