aboutsummaryrefslogtreecommitdiff
path: root/src/core/ngx_connection.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/ngx_connection.c')
-rw-r--r--src/core/ngx_connection.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/core/ngx_connection.c b/src/core/ngx_connection.c
index 88fefcea2..ba07c63e8 100644
--- a/src/core/ngx_connection.c
+++ b/src/core/ngx_connection.c
@@ -1034,6 +1034,10 @@ ngx_close_listening_sockets(ngx_cycle_t *cycle)
ls = cycle->listening.elts;
for (i = 0; i < cycle->listening.nelts; i++) {
+ if (ls[i].quic) {
+ continue;
+ }
+
c = ls[i].connection;
if (c) {
@@ -1179,11 +1183,6 @@ ngx_close_connection(ngx_connection_t *c)
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);
}
@@ -1192,7 +1191,7 @@ ngx_close_connection(ngx_connection_t *c)
ngx_del_timer(c->write);
}
- if (!c->shared) {
+ if (!c->shared && c->fd != (ngx_socket_t) -1) {
if (ngx_del_conn) {
ngx_del_conn(c, NGX_CLOSE_EVENT);
@@ -1224,6 +1223,11 @@ ngx_close_connection(ngx_connection_t *c)
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;