Mercurial > hg > nginx
comparison src/http/ngx_http_upstream_round_robin.c @ 6114:4a640716f4e2
Upstream: fixed unlocked access to peer->conns.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Sun, 19 Apr 2015 22:41:09 +0300 |
parents | 79ddb0bdb273 |
children | cca856715722 |
comparison
equal
deleted
inserted
replaced
6113:36d99c042652 | 6114:4a640716f4e2 |
---|---|
597 | 597 |
598 /* TODO: NGX_PEER_KEEPALIVE */ | 598 /* TODO: NGX_PEER_KEEPALIVE */ |
599 | 599 |
600 peer = rrp->current; | 600 peer = rrp->current; |
601 | 601 |
602 ngx_http_upstream_rr_peers_rlock(rrp->peers); | |
603 ngx_http_upstream_rr_peer_lock(rrp->peers, peer); | |
604 | |
602 if (rrp->peers->single) { | 605 if (rrp->peers->single) { |
603 | 606 |
604 peer->conns--; | 607 peer->conns--; |
608 | |
609 ngx_http_upstream_rr_peer_unlock(rrp->peers, peer); | |
610 ngx_http_upstream_rr_peers_unlock(rrp->peers); | |
605 | 611 |
606 pc->tries = 0; | 612 pc->tries = 0; |
607 return; | 613 return; |
608 } | 614 } |
609 | |
610 ngx_http_upstream_rr_peers_rlock(rrp->peers); | |
611 ngx_http_upstream_rr_peer_lock(rrp->peers, peer); | |
612 | 615 |
613 if (state & NGX_PEER_FAILED) { | 616 if (state & NGX_PEER_FAILED) { |
614 now = ngx_time(); | 617 now = ngx_time(); |
615 | 618 |
616 peer->fails++; | 619 peer->fails++; |