[nginx] svn commit: r5133 - trunk/src/http

ru at nginx.com ru at nginx.com
Mon Mar 25 13:14:49 UTC 2013


Author: ru
Date: 2013-03-25 13:14:49 +0000 (Mon, 25 Mar 2013)
New Revision: 5133
URL: http://trac.nginx.org/nginx/changeset/5133/nginx

Log:
Upstream: only call peer.free() if peer.get() selected a peer.


Modified:
   trunk/src/http/ngx_http_upstream.c

Modified: trunk/src/http/ngx_http_upstream.c
===================================================================
--- trunk/src/http/ngx_http_upstream.c	2013-03-22 15:47:18 UTC (rev 5132)
+++ trunk/src/http/ngx_http_upstream.c	2013-03-25 13:14:49 UTC (rev 5133)
@@ -3147,14 +3147,16 @@
     ngx_http_busy_unlock(u->conf->busy_lock, &u->busy_lock);
 #endif
 
-    if (ft_type == NGX_HTTP_UPSTREAM_FT_HTTP_404) {
-        state = NGX_PEER_NEXT;
-    } else {
-        state = NGX_PEER_FAILED;
-    }
+    if (u->peer.sockaddr) {
 
-    if (ft_type != NGX_HTTP_UPSTREAM_FT_NOLIVE) {
+        if (ft_type == NGX_HTTP_UPSTREAM_FT_HTTP_404) {
+            state = NGX_PEER_NEXT;
+        } else {
+            state = NGX_PEER_FAILED;
+        }
+
         u->peer.free(&u->peer, u->peer.data, state);
+        u->peer.sockaddr = NULL;
     }
 
     if (ft_type == NGX_HTTP_UPSTREAM_FT_TIMEOUT) {
@@ -3314,8 +3316,9 @@
 
     u->finalize_request(r, rc);
 
-    if (u->peer.free) {
+    if (u->peer.free && u->peer.sockaddr) {
         u->peer.free(&u->peer, u->peer.data, 0);
+        u->peer.sockaddr = NULL;
     }
 
     if (u->peer.connection) {



More information about the nginx-devel mailing list