[nginx] svn commit: r4953 - in branches/stable-1.2: . src/http

mdounin at mdounin.ru mdounin at mdounin.ru
Mon Dec 10 16:35:32 UTC 2012


Author: mdounin
Date: 2012-12-10 16:35:32 +0000 (Mon, 10 Dec 2012)
New Revision: 4953
URL: http://trac.nginx.org/nginx/changeset/4953/nginx

Log:
Merge of r4915, r4916, r4917: upstream minor fixes.

*) Upstream: honor the "down" flag for a single server.

   If an upstream block was defined with the only server marked as
   "down", e.g. 
        
       upstream u {
           server 127.0.0.1:8080 down;
       }

   an attempt was made to contact the server despite the "down" flag.
   It is believed that immediate 502 response is better in such a
   case, and it's also consistent with what is currently done in case
   of multiple servers all marked as "down".

*) Upstream: better detection of connect() failures with kqueue.

   Pending EOF might be reported on both read and write events, whichever
   comes first, so check both of them.

   Patch by Yichun Zhang (agentzh), slightly modified.


Modified:
   branches/stable-1.2/
   branches/stable-1.2/src/http/ngx_http_upstream.c
   branches/stable-1.2/src/http/ngx_http_upstream_round_robin.c

Index: branches/stable-1.2
===================================================================
--- branches/stable-1.2	2012-12-10 16:03:56 UTC (rev 4952)
+++ branches/stable-1.2	2012-12-10 16:35:32 UTC (rev 4953)

Property changes on: branches/stable-1.2
___________________________________________________________________
Modified: svn:mergeinfo
## -1 +1 ##
-/trunk:4611-4632,4636-4657,4671-4672,4674-4676,4682,4684-4699,4704-4706,4713,4736-4741,4754,4756-4771,4775,4777-4780,4782-4785,4795,4811-4820,4822-4824,4828-4835,4840-4844,4865-4872,4885-4887,4890-4896,4913-4914
+/trunk:4611-4632,4636-4657,4671-4672,4674-4676,4682,4684-4699,4704-4706,4713,4736-4741,4754,4756-4771,4775,4777-4780,4782-4785,4795,4811-4820,4822-4824,4828-4835,4840-4844,4865-4872,4885-4887,4890-4896,4913-4917
\ No newline at end of property
Modified: branches/stable-1.2/src/http/ngx_http_upstream.c
===================================================================
--- branches/stable-1.2/src/http/ngx_http_upstream.c	2012-12-10 16:03:56 UTC (rev 4952)
+++ branches/stable-1.2/src/http/ngx_http_upstream.c	2012-12-10 16:35:32 UTC (rev 4953)
@@ -1809,9 +1809,16 @@
 #if (NGX_HAVE_KQUEUE)
 
     if (ngx_event_flags & NGX_USE_KQUEUE_EVENT)  {
-        if (c->write->pending_eof) {
+        if (c->write->pending_eof || c->read->pending_eof) {
+            if (c->write->pending_eof) {
+                err = c->write->kq_errno;
+
+            } else {
+                err = c->read->kq_errno;
+            }
+
             c->log->action = "connecting to upstream";
-            (void) ngx_connection_error(c, c->write->kq_errno,
+            (void) ngx_connection_error(c, err,
                                     "kevent() reported that connect() failed");
             return NGX_ERROR;
         }

Modified: branches/stable-1.2/src/http/ngx_http_upstream_round_robin.c
===================================================================
--- branches/stable-1.2/src/http/ngx_http_upstream_round_robin.c	2012-12-10 16:03:56 UTC (rev 4952)
+++ branches/stable-1.2/src/http/ngx_http_upstream_round_robin.c	2012-12-10 16:35:32 UTC (rev 4953)
@@ -430,6 +430,10 @@
     if (rrp->peers->single) {
         peer = &rrp->peers->peer[0];
 
+        if (peer->down) {
+            goto failed;
+        }
+
     } else {
 
         /* there are several peers */



More information about the nginx-devel mailing list