aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_request.c
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2012-10-23 14:36:18 +0000
committerValentin Bartenev <vbart@nginx.com>2012-10-23 14:36:18 +0000
commit09dca40b332cf6c349bff409a9f993d04df35f12 (patch)
tree045eadf935937541d2ffe1ea5e304bae04c3b640 /src/http/ngx_http_request.c
parentf7b32c479d572f3f52657d35d25d01ab3666769c (diff)
downloadnginx-09dca40b332cf6c349bff409a9f993d04df35f12.tar.gz
nginx-09dca40b332cf6c349bff409a9f993d04df35f12.zip
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).
Diffstat (limited to 'src/http/ngx_http_request.c')
-rw-r--r--src/http/ngx_http_request.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index ec9d4a1c3..ef010ff57 100644
--- 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 *rev)
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;
}