]> git.kaiwu.me - nginx.git/commitdiff
QUIC: set NGX_TCP_NODELAY_DISABLED for fake stream connections.
authorSergey Kandaurov <pluknet@nginx.com>
Wed, 22 Sep 2021 11:01:18 +0000 (14:01 +0300)
committerSergey Kandaurov <pluknet@nginx.com>
Wed, 22 Sep 2021 11:01:18 +0000 (14:01 +0300)
Notably, it is to avoid setting the TCP_NODELAY flag for QUIC streams
in ngx_http_upstream_send_response().  It is an invalid operation on
inherently SOCK_DGRAM sockets, which leads to QUIC connection close.

The change reduces diff to the default branch in stream content phase.

src/event/quic/ngx_event_quic_streams.c
src/stream/ngx_stream_core_module.c

index 9473f99b4b321aafb91e87c075242d3f053cef1a..7ad443eecce066f25fbf9a03eb2c2320c508823e 100644 (file)
@@ -450,6 +450,7 @@ ngx_quic_create_stream(ngx_connection_t *c, uint64_t id)
     sc->local_sockaddr = c->local_sockaddr;
     sc->local_socklen = c->local_socklen;
     sc->number = ngx_atomic_fetch_add(ngx_connection_counter, 1);
+    sc->tcp_nodelay = NGX_TCP_NODELAY_DISABLED;
 
     sc->recv = ngx_quic_stream_recv;
     sc->send = ngx_quic_stream_send;
index a312421906f3431657e5006b0ae7de23c7f49744..39c720569201f501b764961fddcad366ebf07975 100644 (file)
@@ -325,9 +325,6 @@ ngx_stream_core_content_phase(ngx_stream_session_t *s,
     cscf = ngx_stream_get_module_srv_conf(s, ngx_stream_core_module);
 
     if (c->type == SOCK_STREAM
-#if (NGX_STREAM_QUIC)
-        && c->quic == NULL
-#endif
         && cscf->tcp_nodelay
         && ngx_tcp_nodelay(c) != NGX_OK)
     {