[PATCH] upstream keepalive: save and restore connection data

RekGRpth rekgrpth at gmail.com
Sat Apr 30 05:03:42 UTC 2022


# HG changeset patch
# User RekGRpth <rekgrpth at gmail.com>
# Date 1651294527 -18000
#      Sat Apr 30 09:55:27 2022 +0500
# Node ID 7b38618adf6317fc268315b8134a5e2b1bc96269
# Parent  a736a7a613ea6e182ff86fbadcb98bb0f8891c0b
upstream keepalive: save and restore connection data

save connection data before keep it
and
restore connection data after yuild it

diff -r a736a7a613ea -r 7b38618adf63 src/http/modules/ngx_http_upstream_keepalive_module.c
--- a/src/http/modules/ngx_http_upstream_keepalive_module.c	Tue Feb 08 17:35:27 2022 +0300
+++ b/src/http/modules/ngx_http_upstream_keepalive_module.c	Sat Apr 30 09:55:27 2022 +0500
@@ -34,6 +34,8 @@
     socklen_t                          socklen;
     ngx_sockaddr_t                     sockaddr;
 
+    void                              *data;
+
 } ngx_http_upstream_keepalive_cache_t;
 
 
@@ -284,7 +286,7 @@
 
     c->idle = 0;
     c->sent = 0;
-    c->data = NULL;
+    c->data = item->data;
     c->log = pc->log;
     c->read->log = pc->log;
     c->write->log = pc->log;
@@ -390,6 +392,7 @@
     c->write->handler = ngx_http_upstream_keepalive_dummy_handler;
     c->read->handler = ngx_http_upstream_keepalive_close_handler;
 
+    item->data = c->data;
     c->data = item;
     c->idle = 1;
     c->log = ngx_cycle->log;



More information about the nginx-devel mailing list