changeset 28:baf671881a8d

Keepalive: log connection used.
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 30 Aug 2011 14:26:05 +0400
parents f3b50effc1d4
children c7c4b2d68fdf
files ngx_http_upstream_keepalive_module.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ngx_http_upstream_keepalive_module.c
+++ b/ngx_http_upstream_keepalive_module.c
@@ -206,13 +206,16 @@ ngx_http_upstream_get_keepalive_peer(ngx
     if (kp->conf->single && !ngx_queue_empty(&kp->conf->cache)) {
 
         q = ngx_queue_head(&kp->conf->cache);
-        ngx_queue_remove(q);
 
         item = ngx_queue_data(q, ngx_http_upstream_keepalive_cache_t, queue);
         c = item->connection;
 
+        ngx_queue_remove(q);
         ngx_queue_insert_head(&kp->conf->free, q);
 
+        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
+                       "get keepalive peer: using connection %p", c);
+
         c->idle = 0;
         c->log = pc->log;
         c->read->log = pc->log;
@@ -248,6 +251,9 @@ ngx_http_upstream_get_keepalive_peer(ngx
             ngx_queue_remove(q);
             ngx_queue_insert_head(&kp->conf->free, q);
 
+            ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
+                           "get keepalive peer: using connection %p", c);
+
             c->idle = 0;
             c->log = pc->log;
             c->read->log = pc->log;