[nginx] Upstream keepalive: reset c->sent on cached connections.

Maxim Dounin mdounin at mdounin.ru
Tue Sep 30 11:18:40 UTC 2014


details:   http://hg.nginx.org/nginx/rev/39befd3c0d84
branches:  
changeset: 5864:39befd3c0d84
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Mon Sep 29 22:27:45 2014 +0400
description:
Upstream keepalive: reset c->sent on cached connections.

The c->sent is reset to 0 on each request by server-side http code,
so do the same on client side.  This allows to count number of bytes
sent in a particular request.

diffstat:

 src/http/modules/ngx_http_upstream_keepalive_module.c |  1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diffs (11 lines):

diff --git a/src/http/modules/ngx_http_upstream_keepalive_module.c b/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
@@ -248,6 +248,7 @@ ngx_http_upstream_get_keepalive_peer(ngx
                            "get keepalive peer: using connection %p", c);
 
             c->idle = 0;
+            c->sent = 0;
             c->log = pc->log;
             c->read->log = pc->log;
             c->write->log = pc->log;



More information about the nginx-devel mailing list