[PATCH 02 of 14] Upstream keepalive: preserve c->data

Piotr Sikora piotrsikora at google.com
Thu Jun 22 20:33:06 UTC 2017


# HG changeset patch
# User Piotr Sikora <piotrsikora at google.com>
# Date 1491886301 25200
#      Mon Apr 10 21:51:41 2017 -0700
# Node ID a147dd50ee3fb8628b79f4482c552c7c2852a732
# Parent  5f5d70428655db0889a2111d17d912a7383df152
Upstream keepalive: preserve c->data.

Signed-off-by: Piotr Sikora <piotrsikora at google.com>

diff -r 5f5d70428655 -r a147dd50ee3f src/http/modules/ngx_http_upstream_keepalive_module.c
--- a/src/http/modules/ngx_http_upstream_keepalive_module.c
+++ b/src/http/modules/ngx_http_upstream_keepalive_module.c
@@ -27,6 +27,7 @@ typedef struct {
 
     ngx_queue_t                        queue;
     ngx_connection_t                  *connection;
+    void                              *data;
 
     socklen_t                          socklen;
     ngx_sockaddr_t                     sockaddr;
@@ -254,6 +255,7 @@ found:
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
                    "get keepalive peer: using connection %p", c);
 
+    c->data = item->data;
     c->idle = 0;
     c->sent = 0;
     c->log = pc->log;
@@ -336,6 +338,7 @@ ngx_http_upstream_free_keepalive_peer(ng
     ngx_queue_insert_head(&kp->conf->cache, q);
 
     item->connection = c;
+    item->data = c->data;
 
     pc->connection = NULL;
 


More information about the nginx-devel mailing list