[njs] Modules: fixed socket leak with 0 fetch timeout.

Dmitry Volyntsev xeioex at nginx.com
Tue Aug 9 23:43:43 UTC 2022


details:   https://hg.nginx.org/njs/rev/5ee3ef8b969c
branches:  
changeset: 1924:5ee3ef8b969c
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Mon Aug 08 22:41:34 2022 -0700
description:
Modules: fixed socket leak with 0 fetch timeout.

diffstat:

 nginx/ngx_js_fetch.c |  8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diffs (25 lines):

diff -r 82e97561e0b4 -r 5ee3ef8b969c nginx/ngx_js_fetch.c
--- a/nginx/ngx_js_fetch.c	Wed Aug 03 20:47:41 2022 -0700
+++ b/nginx/ngx_js_fetch.c	Mon Aug 08 22:41:34 2022 -0700
@@ -907,10 +907,8 @@ ngx_js_http_connect(ngx_js_http_t *http)
 
     http->process = ngx_js_http_process_status_line;
 
-    if (http->timeout) {
-        ngx_add_timer(http->peer.connection->read, http->timeout);
-        ngx_add_timer(http->peer.connection->write, http->timeout);
-    }
+    ngx_add_timer(http->peer.connection->read, http->timeout);
+    ngx_add_timer(http->peer.connection->write, http->timeout);
 
 #if (NGX_SSL)
     if (http->ssl != NULL && http->peer.connection->ssl == NULL) {
@@ -1175,7 +1173,7 @@ ngx_js_http_write_handler(ngx_event_t *w
         }
     }
 
-    if (!wev->timer_set && http->timeout) {
+    if (!wev->timer_set) {
         ngx_add_timer(wev, http->timeout);
     }
 }



More information about the nginx-devel mailing list