diff src/http/modules/ngx_http_upstream_ip_hash_module.c @ 6099:6ff0ebd6fbf4

Upstream: track the number of active connections to upstreams. This also simplifies the implementation of the least_conn module.
author Ruslan Ermilov <ru@nginx.com>
date Fri, 10 Apr 2015 13:16:23 +0300
parents a2bf26774cd3
children c44459611d91
line wrap: on
line diff
--- a/src/http/modules/ngx_http_upstream_ip_hash_module.c
+++ b/src/http/modules/ngx_http_upstream_ip_hash_module.c
@@ -242,6 +242,8 @@ ngx_http_upstream_get_ip_hash_peer(ngx_p
     pc->socklen = peer->socklen;
     pc->name = &peer->name;
 
+    peer->conns++;
+
     if (now - peer->checked > peer->fail_timeout) {
         peer->checked = now;
     }