Mercurial > hg > nginx
changeset 8842:486c6a9be111 quic
QUIC: store QUIC connection fd in stream fake connection.
Previously it had -1 as fd. This fixes proxying, which relies on downstream
connection having a real fd. Also, this reduces diff to the default branch for
ngx_close_connection().
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Mon, 06 Sep 2021 16:59:00 +0300 |
parents | 1f7f98638dc2 |
children | 4ca8035c19a4 |
files | src/core/ngx_connection.c src/event/quic/ngx_event_quic_streams.c |
diffstat | 2 files changed, 8 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/core/ngx_connection.c Fri Sep 03 14:23:50 2021 +0300 +++ b/src/core/ngx_connection.c Mon Sep 06 16:59:00 2021 +0300 @@ -1185,6 +1185,11 @@ ngx_uint_t log_error, level; ngx_socket_t fd; + if (c->fd == (ngx_socket_t) -1) { + ngx_log_error(NGX_LOG_ALERT, c->log, 0, "connection already closed"); + return; + } + if (c->read->timer_set) { ngx_del_timer(c->read); } @@ -1193,7 +1198,7 @@ ngx_del_timer(c->write); } - if (!c->shared && c->fd != (ngx_socket_t) -1) { + if (!c->shared) { if (ngx_del_conn) { ngx_del_conn(c, NGX_CLOSE_EVENT); @@ -1225,11 +1230,6 @@ ngx_free_connection(c); - if (c->fd == (ngx_socket_t) -1) { - ngx_log_debug0(NGX_LOG_DEBUG_CORE, c->log, 0, "connection has no fd"); - return; - } - fd = c->fd; c->fd = (ngx_socket_t) -1;
--- a/src/event/quic/ngx_event_quic_streams.c Fri Sep 03 14:23:50 2021 +0300 +++ b/src/event/quic/ngx_event_quic_streams.c Mon Sep 06 16:59:00 2021 +0300 @@ -440,6 +440,8 @@ qs->connection = sc; sc->quic = qs; + sc->fd = c->fd; + sc->shared = 1; sc->type = SOCK_STREAM; sc->pool = pool; sc->ssl = c->ssl;