diff src/core/ngx_connection.c @ 8217:a5a1b3fad834 quic

Fixed sanitizer errors.
author Roman Arutyunyan <arut@nginx.com>
date Fri, 13 Mar 2020 20:44:32 +0300
parents e7b2b907c0f8
children db8fe75c9c7a
line wrap: on
line diff
--- a/src/core/ngx_connection.c
+++ b/src/core/ngx_connection.c
@@ -1178,11 +1178,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);
     }
@@ -1191,7 +1186,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);
 
@@ -1223,6 +1218,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;