summaryrefslogtreecommitdiff
path: root/www/nginx-devel/files/extra-patch-src-http-modules-ngx_http_upstream_hash_module.c
blob: 9267e597829f243430fb0d6f324175315bd88622 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
--- src/http/modules/ngx_http_upstream_hash_module.c.orig	2016-02-24 14:53:24 UTC
+++ src/http/modules/ngx_http_upstream_hash_module.c
@@ -9,6 +9,9 @@
 #include <ngx_core.h>
 #include <ngx_http.h>
 
+#if (NGX_HTTP_UPSTREAM_CHECK)
+#include "ngx_http_upstream_check_module.h"
+#endif
 
 typedef struct {
     uint32_t                            hash;
@@ -235,6 +238,15 @@ ngx_http_upstream_get_hash_peer(ngx_peer
             goto next;
         }
 
+#if (NGX_HTTP_UPSTREAM_CHECK)
+        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
+            "get hash peer, check_index: %ui",
+             peer->check_index);
+        if (ngx_http_upstream_check_peer_down(peer->check_index)) {
+            goto next;
+        }
+#endif
+
         if (peer->max_fails
             && peer->fails >= peer->max_fails
             && now - peer->checked <= peer->fail_timeout)
@@ -535,6 +547,15 @@ ngx_http_upstream_get_chash_peer(ngx_pee
                 continue;
             }
 
+#if (NGX_HTTP_UPSTREAM_CHECK)
+            ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
+                "get consistent_hash peer, check_index: %ui",
+                 peer->check_index);
+            if (ngx_http_upstream_check_peer_down(peer->check_index)) {
+                continue;
+            }
+#endif
+
             if (peer->server.len != server->len
                 || ngx_strncmp(peer->server.data, server->data, server->len)
                    != 0)