Skip to content
Snippets Groups Projects
Commit dbc7ccfc authored by Bartolomeo Berend Müller's avatar Bartolomeo Berend Müller
Browse files

Fix nginx quic initial congestion window

parent 3a254bb5
No related branches found
No related tags found
No related merge requests found
......@@ -122,6 +122,7 @@ echo "Openssl seems to be installed correctly"
# apply patches to nginx source
patch ${ROOT}/nginx-${NGINX_VERSION}/src/event/quic/ngx_event_quic_openssl_compat.c < ${ROOT}/../patches/nginx-${NGINX_VERSION}-patches/ngx_event_quic_openssl_compat.c.diff
patch ${ROOT}/nginx-${NGINX_VERSION}/src/event/quic/ngx_event_quic.c < ${ROOT}/../patches/nginx-${NGINX_VERSION}-patches/ngx_event_quic.c.diff
# build nginx with dynamically linked custom openssl
# NOTE it may be that the first time nginx is built it is not linked correctly to the custom openssl, but just do it again, it should work
......
--- ngx_event_quic.c 2024-05-28 15:28:07.000000000 +0200
+++ ngx_event_quic.c 2025-02-04 23:33:38.990662931 +0100
@@ -308,8 +308,13 @@
qc->streams.client_max_streams_uni = qc->tp.initial_max_streams_uni;
qc->streams.client_max_streams_bidi = qc->tp.initial_max_streams_bidi;
- qc->congestion.window = ngx_min(10 * qc->tp.max_udp_payload_size,
- ngx_max(2 * qc->tp.max_udp_payload_size,
+ // qc->tp.max_udp_payload_size is set via a constant in ngx_quic_init_transport_params() to 65527 which is wrong.
+ // It is not set by inspecting the peer's transport parameters, i think this happens at a later time in ngx_quic_apply_transport_params(),
+ // but there the initial congestion window is not recalculated and can't be since the peer's transport parameters are not available at that time.
+ // So for a fix for this experiment, the max_udp_payload_size is set to 1200 for only the calculation of the initial congestion window.
+ const int PATCHED_MAX_UDP_PAYLOAD_SIZE = 1200;
+ qc->congestion.window = ngx_min(10 * PATCHED_MAX_UDP_PAYLOAD_SIZE,
+ ngx_max(2 * PATCHED_MAX_UDP_PAYLOAD_SIZE,
14720));
qc->congestion.ssthresh = (size_t) -1;
qc->congestion.recovery_start = ngx_current_msec;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment