changeset 4891:1e666c78a42c

ngx_http_keepalive_handler() is now trying to not keep c->buffer's memory for idle connections. This behaviour is consistent with the ngx_http_set_keepalive() function and it should decrease memory usage in some cases (especially if epoll/rtsig is used).
author Valentin Bartenev <vbart@nginx.com>
date Tue, 23 Oct 2012 14:36:18 +0000
parents 173cd5458281
children 063ac68d89dc
files src/http/ngx_http_request.c
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -2753,6 +2753,20 @@ ngx_http_keepalive_handler(ngx_event_t *
             ngx_http_close_connection(c);
         }
 
+        /*
+         * Like ngx_http_set_keepalive() we are trying to not hold
+         * c->buffer's memory for a keepalive connection.
+         */
+
+        if (ngx_pfree(c->pool, b->start) == NGX_OK) {
+
+            /*
+             * the special note that c->buffer's memory was freed
+             */
+
+            b->pos = NULL;
+        }
+
         return;
     }