Mercurial > hg > nginx-vendor-current
comparison src/http/modules/ngx_http_upstream_ip_hash_module.c @ 330:5e3b425174f6 NGINX_0_6_9
nginx 0.6.9
*) Bugfix: a worker process may got caught in an endless loop, if the
HTTPS protocol was used; bug appeared in 0.6.7.
*) Bugfix: if server listened on two addresses or ports and trailing
wildcard was used, then nginx did not run.
*) Bugfix: the "ip_hash" directive might incorrectly mark servers as
down.
*) Bugfix: nginx could not be built on amd64; bug appeared in 0.6.8.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Tue, 28 Aug 2007 00:00:00 +0400 |
parents | fc223117327f |
children | 76a79816b771 |
comparison
equal
deleted
inserted
replaced
329:f2f8dc3e7933 | 330:5e3b425174f6 |
---|---|
138 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, | 138 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, |
139 "get ip hash peer, try: %ui", pc->tries); | 139 "get ip hash peer, try: %ui", pc->tries); |
140 | 140 |
141 /* TODO: cached */ | 141 /* TODO: cached */ |
142 | 142 |
143 if (iphp->tries > 20 || iphp->rrp.peers->number == 1) { | 143 if (iphp->tries > 20 || iphp->rrp.peers->single) { |
144 return iphp->get_rr_peer(pc, &iphp->rrp); | 144 return iphp->get_rr_peer(pc, &iphp->rrp); |
145 } | 145 } |
146 | 146 |
147 now = ngx_time(); | 147 now = ngx_time(); |
148 | 148 |
158 } | 158 } |
159 | 159 |
160 p = hash % iphp->rrp.peers->number; | 160 p = hash % iphp->rrp.peers->number; |
161 | 161 |
162 n = p / (8 * sizeof(uintptr_t)); | 162 n = p / (8 * sizeof(uintptr_t)); |
163 m = 1 << p % (8 * sizeof(uintptr_t)); | 163 m = (uintptr_t) 1 << p % (8 * sizeof(uintptr_t)); |
164 | 164 |
165 if (!(iphp->rrp.tried[n] & m)) { | 165 if (!(iphp->rrp.tried[n] & m)) { |
166 | 166 |
167 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, pc->log, 0, | 167 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, pc->log, 0, |
168 "get ip hash peer, hash: %ui %04XA", p, m); | 168 "get ip hash peer, hash: %ui %04XA", p, m); |
193 if (++iphp->tries >= 20) { | 193 if (++iphp->tries >= 20) { |
194 return iphp->get_rr_peer(pc, &iphp->rrp); | 194 return iphp->get_rr_peer(pc, &iphp->rrp); |
195 } | 195 } |
196 } | 196 } |
197 | 197 |
198 iphp->rrp.current = p; | |
199 | |
198 pc->sockaddr = peer->sockaddr; | 200 pc->sockaddr = peer->sockaddr; |
199 pc->socklen = peer->socklen; | 201 pc->socklen = peer->socklen; |
200 pc->name = &peer->name; | 202 pc->name = &peer->name; |
201 | 203 |
202 /* ngx_unlock_mutex(iphp->rrp.peers->mutex); */ | 204 /* ngx_unlock_mutex(iphp->rrp.peers->mutex); */ |