From 546b7e0a0fc2a3064eff630cdb8d61e64951b11f Mon Sep 17 00:00:00 2001 From: Wang xiaokai Date: Sun, 13 Dec 2015 12:54:30 +0800 Subject: [PATCH] delete some patches for newly featrue, compatible with nginx-1.8.0+ --- check_1.2.1.patch | 160 ----------------------------- check_1.2.2+.patch | 209 -------------------------------------- check_1.2.6+.patch | 209 -------------------------------------- check_1.5.12+.patch | 198 ------------------------------------ check_1.7.2+.patch | 239 -------------------------------------------- 5 files changed, 1015 deletions(-) delete mode 100644 check_1.2.1.patch delete mode 100644 check_1.2.2+.patch delete mode 100644 check_1.2.6+.patch delete mode 100644 check_1.5.12+.patch delete mode 100644 check_1.7.2+.patch diff --git a/check_1.2.1.patch b/check_1.2.1.patch deleted file mode 100644 index 44a5bda..0000000 --- a/check_1.2.1.patch +++ /dev/null @@ -1,160 +0,0 @@ -diff --git a/src/http/modules/ngx_http_upstream_ip_hash_module.c b/src/http/modules/ngx_http_upstream_ip_hash_module.c -index 100ea34..642b01b 100644 ---- a/src/http/modules/ngx_http_upstream_ip_hash_module.c -+++ b/src/http/modules/ngx_http_upstream_ip_hash_module.c -@@ -9,6 +9,10 @@ - #include - #include - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+#include "ngx_http_upstream_check_module.h" -+#endif -+ - - typedef struct { - /* the round robin data must be first */ -@@ -182,6 +186,12 @@ ngx_http_upstream_get_ip_hash_peer(ngx_peer_connection_t *pc, void *data) - - if (!peer->down) { - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, -+ "get ip_hash peer, check_index: %ui", -+ peer->check_index); -+ if (!ngx_http_upstream_check_peer_down(peer->check_index)) { -+#endif - if (peer->max_fails == 0 || peer->fails < peer->max_fails) { - break; - } -@@ -190,6 +200,9 @@ ngx_http_upstream_get_ip_hash_peer(ngx_peer_connection_t *pc, void *data) - peer->checked = now; - break; - } -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ } -+#endif - } - - iphp->rrp.tried[n] |= m; -diff --git a/src/http/ngx_http_upstream_round_robin.c b/src/http/ngx_http_upstream_round_robin.c -index 214de7b..309725b 100644 ---- a/src/http/ngx_http_upstream_round_robin.c -+++ b/src/http/ngx_http_upstream_round_robin.c -@@ -9,6 +9,9 @@ - #include - #include - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+#include "ngx_http_upstream_check_module.h" -+#endif - - static ngx_int_t ngx_http_upstream_cmp_servers(const void *one, - const void *two); -@@ -83,7 +86,17 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf, - peers->peer[n].weight = server[i].weight; - peers->peer[n].effective_weight = server[i].weight; - peers->peer[n].current_weight = 0; -- n++; -+ -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ if (!server[i].down) { -+ peers->peer[n].check_index = -+ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]); -+ } -+ else { -+ peers->peer[n].check_index = (ngx_uint_t) NGX_ERROR; -+ } -+#endif -+ n++; - } - } - -@@ -137,6 +150,17 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf, - backup->peer[n].max_fails = server[i].max_fails; - backup->peer[n].fail_timeout = server[i].fail_timeout; - backup->peer[n].down = server[i].down; -+ -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ if (!server[i].down) { -+ backup->peer[n].check_index = -+ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]); -+ } -+ else { -+ backup->peer[n].check_index = (ngx_uint_t) NGX_ERROR; -+ } -+#endif -+ - n++; - } - } -@@ -196,6 +220,9 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf, - peers->peer[i].current_weight = 0; - peers->peer[i].max_fails = 1; - peers->peer[i].fail_timeout = 10; -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR; -+#endif - } - - us->peer.data = peers; -@@ -313,6 +340,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r, - peers->peer[0].current_weight = 0; - peers->peer[0].max_fails = 1; - peers->peer[0].fail_timeout = 10; -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ peers->peer[0].check_index = (ngx_uint_t) NGX_ERROR; -+#endif - - } else { - -@@ -346,6 +376,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r, - peers->peer[i].current_weight = 0; - peers->peer[i].max_fails = 1; - peers->peer[i].fail_timeout = 10; -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR; -+#endif - } - } - -@@ -419,7 +452,11 @@ ngx_http_upstream_get_round_robin_peer(ngx_peer_connection_t *pc, void *data) - - if (rrp->peers->single) { - peer = &rrp->peers->peer[0]; -- -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ if (ngx_http_upstream_check_peer_down(peer->check_index)) { -+ return NGX_BUSY; -+ } -+#endif - } else { - - /* there are several peers */ -@@ -517,6 +554,12 @@ ngx_http_upstream_get_peer(ngx_http_upstream_rr_peer_data_t *rrp) - continue; - } - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ if (ngx_http_upstream_check_peer_down(peer->check_index)) { -+ continue; -+ } -+#endif -+ - if (peer->max_fails - && peer->fails >= peer->max_fails - && now - peer->checked <= peer->fail_timeout) -diff --git a/src/http/ngx_http_upstream_round_robin.h b/src/http/ngx_http_upstream_round_robin.h -index 4de3cae..164867b 100644 ---- a/src/http/ngx_http_upstream_round_robin.h -+++ b/src/http/ngx_http_upstream_round_robin.h -@@ -30,6 +30,10 @@ typedef struct { - ngx_uint_t max_fails; - time_t fail_timeout; - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ ngx_uint_t check_index; -+#endif -+ - ngx_uint_t down; /* unsigned down:1; */ - - #if (NGX_HTTP_SSL) diff --git a/check_1.2.2+.patch b/check_1.2.2+.patch deleted file mode 100644 index e98bac4..0000000 --- a/check_1.2.2+.patch +++ /dev/null @@ -1,209 +0,0 @@ -diff --git a/src/http/modules/ngx_http_upstream_ip_hash_module.c b/src/http/modules/ngx_http_upstream_ip_hash_module.c -index 89ccc2b..a552044 100644 ---- a/src/http/modules/ngx_http_upstream_ip_hash_module.c -+++ b/src/http/modules/ngx_http_upstream_ip_hash_module.c -@@ -9,6 +9,10 @@ - #include - #include - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+#include "ngx_http_upstream_check_module.h" -+#endif -+ - - typedef struct { - /* the round robin data must be first */ -@@ -208,6 +212,12 @@ ngx_http_upstream_get_ip_hash_peer(ngx_peer_connection_t *pc, void *data) - - if (!peer->down) { - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, -+ "get ip_hash peer, check_index: %ui", -+ peer->check_index); -+ if (!ngx_http_upstream_check_peer_down(peer->check_index)) { -+#endif - if (peer->max_fails == 0 || peer->fails < peer->max_fails) { - break; - } -@@ -216,6 +226,9 @@ ngx_http_upstream_get_ip_hash_peer(ngx_peer_connection_t *pc, void *data) - peer->checked = now; - break; - } -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ } -+#endif - } - - iphp->rrp.tried[n] |= m; -diff --git a/src/http/modules/ngx_http_upstream_least_conn_module.c b/src/http/modules/ngx_http_upstream_least_conn_module.c -index 50e68b2..f2f32cc 100644 ---- a/src/http/modules/ngx_http_upstream_least_conn_module.c -+++ b/src/http/modules/ngx_http_upstream_least_conn_module.c -@@ -9,6 +9,10 @@ - #include - #include - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+#include "ngx_http_upstream_check_module.h" -+#endif -+ - - typedef struct { - ngx_uint_t *conns; -@@ -203,6 +207,16 @@ ngx_http_upstream_get_least_conn_peer(ngx_peer_connection_t *pc, void *data) - continue; - } - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, -+ "get least_conn peer, check_index: %ui", -+ peer->check_index); -+ -+ if (ngx_http_upstream_check_peer_down(peer->check_index)) { -+ continue; -+ } -+#endif -+ - if (peer->max_fails - && peer->fails >= peer->max_fails - && now - peer->checked <= peer->fail_timeout) -@@ -256,6 +270,16 @@ ngx_http_upstream_get_least_conn_peer(ngx_peer_connection_t *pc, void *data) - continue; - } - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, -+ "get least_conn peer, check_index: %ui", -+ peer->check_index); -+ -+ if (ngx_http_upstream_check_peer_down(peer->check_index)) { -+ continue; -+ } -+#endif -+ - if (lcp->conns[i] * best->weight != lcp->conns[p] * peer->weight) { - continue; - } -diff --git a/src/http/ngx_http_upstream_round_robin.c b/src/http/ngx_http_upstream_round_robin.c -index c4998fc..f3e9378 100644 ---- a/src/http/ngx_http_upstream_round_robin.c -+++ b/src/http/ngx_http_upstream_round_robin.c -@@ -9,6 +9,9 @@ - #include - #include - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+#include "ngx_http_upstream_check_module.h" -+#endif - - static ngx_int_t ngx_http_upstream_cmp_servers(const void *one, - const void *two); -@@ -87,7 +90,17 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf, - peers->peer[n].weight = server[i].weight; - peers->peer[n].effective_weight = server[i].weight; - peers->peer[n].current_weight = 0; -- n++; -+ -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ if (!server[i].down) { -+ peers->peer[n].check_index = -+ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]); -+ } -+ else { -+ peers->peer[n].check_index = (ngx_uint_t) NGX_ERROR; -+ } -+#endif -+ n++; - } - } - -@@ -145,6 +158,17 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf, - backup->peer[n].max_fails = server[i].max_fails; - backup->peer[n].fail_timeout = server[i].fail_timeout; - backup->peer[n].down = server[i].down; -+ -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ if (!server[i].down) { -+ backup->peer[n].check_index = -+ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]); -+ } -+ else { -+ backup->peer[n].check_index = (ngx_uint_t) NGX_ERROR; -+ } -+#endif -+ - n++; - } - } -@@ -206,6 +230,9 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf, - peers->peer[i].current_weight = 0; - peers->peer[i].max_fails = 1; - peers->peer[i].fail_timeout = 10; -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR; -+#endif - } - - us->peer.data = peers; -@@ -323,6 +350,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r, - peers->peer[0].current_weight = 0; - peers->peer[0].max_fails = 1; - peers->peer[0].fail_timeout = 10; -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ peers->peer[0].check_index = (ngx_uint_t) NGX_ERROR; -+#endif - - } else { - -@@ -356,6 +386,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r, - peers->peer[i].current_weight = 0; - peers->peer[i].max_fails = 1; - peers->peer[i].fail_timeout = 10; -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR; -+#endif - } - } - -@@ -429,7 +462,11 @@ ngx_http_upstream_get_round_robin_peer(ngx_peer_connection_t *pc, void *data) - - if (rrp->peers->single) { - peer = &rrp->peers->peer[0]; -- -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ if (ngx_http_upstream_check_peer_down(peer->check_index)) { -+ return NGX_BUSY; -+ } -+#endif - } else { - - /* there are several peers */ -@@ -527,6 +564,12 @@ ngx_http_upstream_get_peer(ngx_http_upstream_rr_peer_data_t *rrp) - continue; - } - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ if (ngx_http_upstream_check_peer_down(peer->check_index)) { -+ continue; -+ } -+#endif -+ - if (peer->max_fails - && peer->fails >= peer->max_fails - && now - peer->checked <= peer->fail_timeout) -diff --git a/src/http/ngx_http_upstream_round_robin.h b/src/http/ngx_http_upstream_round_robin.h -index 3f8cbf8..1613168 100644 ---- a/src/http/ngx_http_upstream_round_robin.h -+++ b/src/http/ngx_http_upstream_round_robin.h -@@ -30,6 +30,10 @@ typedef struct { - ngx_uint_t max_fails; - time_t fail_timeout; - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ ngx_uint_t check_index; -+#endif -+ - ngx_uint_t down; /* unsigned down:1; */ - - #if (NGX_HTTP_SSL) diff --git a/check_1.2.6+.patch b/check_1.2.6+.patch deleted file mode 100644 index fe176bb..0000000 --- a/check_1.2.6+.patch +++ /dev/null @@ -1,209 +0,0 @@ -diff --git a/src/http/modules/ngx_http_upstream_ip_hash_module.c b/src/http/modules/ngx_http_upstream_ip_hash_module.c -index 89ccc2b..a552044 100644 ---- a/src/http/modules/ngx_http_upstream_ip_hash_module.c -+++ b/src/http/modules/ngx_http_upstream_ip_hash_module.c -@@ -9,6 +9,10 @@ - #include - #include - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+#include "ngx_http_upstream_check_module.h" -+#endif -+ - - typedef struct { - /* the round robin data must be first */ -@@ -208,6 +212,12 @@ ngx_http_upstream_get_ip_hash_peer(ngx_peer_connection_t *pc, void *data) - - if (!peer->down) { - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, -+ "get ip_hash peer, check_index: %ui", -+ peer->check_index); -+ if (!ngx_http_upstream_check_peer_down(peer->check_index)) { -+#endif - if (peer->max_fails == 0 || peer->fails < peer->max_fails) { - break; - } -@@ -216,6 +226,9 @@ ngx_http_upstream_get_ip_hash_peer(ngx_peer_connection_t *pc, void *data) - peer->checked = now; - break; - } -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ } -+#endif - } - - iphp->rrp.tried[n] |= m; -diff --git a/src/http/modules/ngx_http_upstream_least_conn_module.c b/src/http/modules/ngx_http_upstream_least_conn_module.c -index 21156ae..c57393d 100644 ---- a/src/http/modules/ngx_http_upstream_least_conn_module.c -+++ b/src/http/modules/ngx_http_upstream_least_conn_module.c -@@ -9,6 +9,10 @@ - #include - #include - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+#include "ngx_http_upstream_check_module.h" -+#endif -+ - - typedef struct { - ngx_uint_t *conns; -@@ -203,6 +207,16 @@ ngx_http_upstream_get_least_conn_peer(ngx_peer_connection_t *pc, void *data) - continue; - } - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, -+ "get least_conn peer, check_index: %ui", -+ peer->check_index); -+ -+ if (ngx_http_upstream_check_peer_down(peer->check_index)) { -+ continue; -+ } -+#endif -+ - if (peer->max_fails - && peer->fails >= peer->max_fails - && now - peer->checked <= peer->fail_timeout) -@@ -256,6 +270,16 @@ ngx_http_upstream_get_least_conn_peer(ngx_peer_connection_t *pc, void *data) - continue; - } - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, -+ "get least_conn peer, check_index: %ui", -+ peer->check_index); -+ -+ if (ngx_http_upstream_check_peer_down(peer->check_index)) { -+ continue; -+ } -+#endif -+ - if (lcp->conns[i] * best->weight != lcp->conns[p] * peer->weight) { - continue; - } -diff --git a/src/http/ngx_http_upstream_round_robin.c b/src/http/ngx_http_upstream_round_robin.c -index 4b78cff..f077b46 100644 ---- a/src/http/ngx_http_upstream_round_robin.c -+++ b/src/http/ngx_http_upstream_round_robin.c -@@ -9,6 +9,9 @@ - #include - #include - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+#include "ngx_http_upstream_check_module.h" -+#endif - - static ngx_int_t ngx_http_upstream_cmp_servers(const void *one, - const void *two); -@@ -87,7 +90,17 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf, - peers->peer[n].weight = server[i].weight; - peers->peer[n].effective_weight = server[i].weight; - peers->peer[n].current_weight = 0; -- n++; -+ -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ if (!server[i].down) { -+ peers->peer[n].check_index = -+ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]); -+ } -+ else { -+ peers->peer[n].check_index = (ngx_uint_t) NGX_ERROR; -+ } -+#endif -+ n++; - } - } - -@@ -145,6 +158,17 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf, - backup->peer[n].max_fails = server[i].max_fails; - backup->peer[n].fail_timeout = server[i].fail_timeout; - backup->peer[n].down = server[i].down; -+ -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ if (!server[i].down) { -+ backup->peer[n].check_index = -+ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]); -+ } -+ else { -+ backup->peer[n].check_index = (ngx_uint_t) NGX_ERROR; -+ } -+#endif -+ - n++; - } - } -@@ -206,6 +230,9 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf, - peers->peer[i].current_weight = 0; - peers->peer[i].max_fails = 1; - peers->peer[i].fail_timeout = 10; -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR; -+#endif - } - - us->peer.data = peers; -@@ -323,6 +350,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r, - peers->peer[0].current_weight = 0; - peers->peer[0].max_fails = 1; - peers->peer[0].fail_timeout = 10; -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ peers->peer[0].check_index = (ngx_uint_t) NGX_ERROR; -+#endif - - } else { - -@@ -356,6 +386,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r, - peers->peer[i].current_weight = 0; - peers->peer[i].max_fails = 1; - peers->peer[i].fail_timeout = 10; -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR; -+#endif - } - } - -@@ -434,6 +467,12 @@ ngx_http_upstream_get_round_robin_peer(ngx_peer_connection_t *pc, void *data) - goto failed; - } - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ if (ngx_http_upstream_check_peer_down(peer->check_index)) { -+ goto failed; -+ } -+#endif -+ - } else { - - /* there are several peers */ -@@ -531,6 +570,12 @@ ngx_http_upstream_get_peer(ngx_http_upstream_rr_peer_data_t *rrp) - continue; - } - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ if (ngx_http_upstream_check_peer_down(peer->check_index)) { -+ continue; -+ } -+#endif -+ - if (peer->max_fails - && peer->fails >= peer->max_fails - && now - peer->checked <= peer->fail_timeout) -diff --git a/src/http/ngx_http_upstream_round_robin.h b/src/http/ngx_http_upstream_round_robin.h -index 3f8cbf8..1613168 100644 ---- a/src/http/ngx_http_upstream_round_robin.h -+++ b/src/http/ngx_http_upstream_round_robin.h -@@ -30,6 +30,10 @@ typedef struct { - ngx_uint_t max_fails; - time_t fail_timeout; - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ ngx_uint_t check_index; -+#endif -+ - ngx_uint_t down; /* unsigned down:1; */ - - #if (NGX_HTTP_SSL) diff --git a/check_1.5.12+.patch b/check_1.5.12+.patch deleted file mode 100644 index a62c1b1..0000000 --- a/check_1.5.12+.patch +++ /dev/null @@ -1,198 +0,0 @@ -diff --git a/src/http/modules/ngx_http_upstream_ip_hash_module.c b/src/http/modules/ngx_http_upstream_ip_hash_module.c -index 041883f..b1bc7d0 100644 ---- a/src/http/modules/ngx_http_upstream_ip_hash_module.c -+++ b/src/http/modules/ngx_http_upstream_ip_hash_module.c -@@ -9,6 +9,10 @@ - #include - #include - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+#include "ngx_http_upstream_check_module.h" -+#endif -+ - - typedef struct { - /* the round robin data must be first */ -@@ -212,6 +216,15 @@ ngx_http_upstream_get_ip_hash_peer(ngx_peer_connection_t *pc, void *data) - goto next_try; - } - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, -+ "get ip_hash peer, check_index: %ui", -+ peer->check_index); -+ if (ngx_http_upstream_check_peer_down(peer->check_index)) { -+ goto next_try; -+ } -+#endif -+ - if (peer->max_fails - && peer->fails >= peer->max_fails - && now - peer->checked <= peer->fail_timeout) -diff --git a/src/http/modules/ngx_http_upstream_least_conn_module.c b/src/http/modules/ngx_http_upstream_least_conn_module.c -index dbef95d..dc9b518 100644 ---- a/src/http/modules/ngx_http_upstream_least_conn_module.c -+++ b/src/http/modules/ngx_http_upstream_least_conn_module.c -@@ -9,6 +9,10 @@ - #include - #include - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+#include "ngx_http_upstream_check_module.h" -+#endif -+ - - typedef struct { - ngx_uint_t *conns; -@@ -203,6 +207,16 @@ ngx_http_upstream_get_least_conn_peer(ngx_peer_connection_t *pc, void *data) - continue; - } - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, -+ "get least_conn peer, check_index: %ui", -+ peer->check_index); -+ -+ if (ngx_http_upstream_check_peer_down(peer->check_index)) { -+ continue; -+ } -+#endif -+ - if (peer->max_fails - && peer->fails >= peer->max_fails - && now - peer->checked <= peer->fail_timeout) -@@ -256,6 +270,16 @@ ngx_http_upstream_get_least_conn_peer(ngx_peer_connection_t *pc, void *data) - continue; - } - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, -+ "get least_conn peer, check_index: %ui", -+ peer->check_index); -+ -+ if (ngx_http_upstream_check_peer_down(peer->check_index)) { -+ continue; -+ } -+#endif -+ - if (lcp->conns[i] * best->weight != lcp->conns[p] * peer->weight) { - continue; - } -diff --git a/src/http/ngx_http_upstream_round_robin.c b/src/http/ngx_http_upstream_round_robin.c -index 85ff558..2fe9bb6 100644 ---- a/src/http/ngx_http_upstream_round_robin.c -+++ b/src/http/ngx_http_upstream_round_robin.c -@@ -9,6 +9,9 @@ - #include - #include - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+#include "ngx_http_upstream_check_module.h" -+#endif - - static ngx_http_upstream_rr_peer_t *ngx_http_upstream_get_peer( - ngx_http_upstream_rr_peer_data_t *rrp); -@@ -85,6 +88,14 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf, - peers->peer[n].max_fails = server[i].max_fails; - peers->peer[n].fail_timeout = server[i].fail_timeout; - peers->peer[n].down = server[i].down; -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ if (!server[i].down) { -+ peers->peer[n].check_index = -+ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]); -+ } else { -+ peers->peer[n].check_index = (ngx_uint_t) NGX_ERROR; -+ } -+#endif - n++; - } - } -@@ -139,6 +150,17 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf, - backup->peer[n].max_fails = server[i].max_fails; - backup->peer[n].fail_timeout = server[i].fail_timeout; - backup->peer[n].down = server[i].down; -+ -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ if (!server[i].down) { -+ backup->peer[n].check_index = -+ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]); -+ } -+ else { -+ backup->peer[n].check_index = (ngx_uint_t) NGX_ERROR; -+ } -+#endif -+ - n++; - } - } -@@ -196,6 +218,9 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf, - peers->peer[i].current_weight = 0; - peers->peer[i].max_fails = 1; - peers->peer[i].fail_timeout = 10; -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR; -+#endif - } - - us->peer.data = peers; -@@ -302,6 +327,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r, - peers->peer[0].current_weight = 0; - peers->peer[0].max_fails = 1; - peers->peer[0].fail_timeout = 10; -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ peers->peer[0].check_index = (ngx_uint_t) NGX_ERROR; -+#endif - - } else { - -@@ -342,6 +370,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r, - peers->peer[i].current_weight = 0; - peers->peer[i].max_fails = 1; - peers->peer[i].fail_timeout = 10; -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR; -+#endif - } - } - -@@ -399,6 +430,12 @@ ngx_http_upstream_get_round_robin_peer(ngx_peer_connection_t *pc, void *data) - goto failed; - } - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ if (ngx_http_upstream_check_peer_down(peer->check_index)) { -+ goto failed; -+ } -+#endif -+ - } else { - - /* there are several peers */ -@@ -498,6 +535,12 @@ ngx_http_upstream_get_peer(ngx_http_upstream_rr_peer_data_t *rrp) - continue; - } - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ if (ngx_http_upstream_check_peer_down(peer->check_index)) { -+ continue; -+ } -+#endif -+ - if (peer->max_fails - && peer->fails >= peer->max_fails - && now - peer->checked <= peer->fail_timeout) -diff --git a/src/http/ngx_http_upstream_round_robin.h b/src/http/ngx_http_upstream_round_robin.h -index ea90ab9..a6fb33f 100644 ---- a/src/http/ngx_http_upstream_round_robin.h -+++ b/src/http/ngx_http_upstream_round_robin.h -@@ -30,6 +30,10 @@ typedef struct { - ngx_uint_t max_fails; - time_t fail_timeout; - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ ngx_uint_t check_index; -+#endif -+ - ngx_uint_t down; /* unsigned down:1; */ - - #if (NGX_HTTP_SSL) diff --git a/check_1.7.2+.patch b/check_1.7.2+.patch deleted file mode 100644 index 57ad64e..0000000 --- a/check_1.7.2+.patch +++ /dev/null @@ -1,239 +0,0 @@ -diff --git a/src/http/modules/ngx_http_upstream_hash_module.c b/src/http/modules/ngx_http_upstream_hash_module.c -index 777e180..e302f52 100644 ---- a/src/http/modules/ngx_http_upstream_hash_module.c -+++ b/src/http/modules/ngx_http_upstream_hash_module.c -@@ -9,6 +9,9 @@ - #include - #include - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+#include "ngx_http_upstream_check_module.h" -+#endif - - typedef struct { - uint32_t hash; -@@ -240,6 +243,14 @@ ngx_http_upstream_get_hash_peer(ngx_peer_connection_t *pc, void *data) - 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) -@@ -506,6 +517,14 @@ ngx_http_upstream_get_chash_peer(ngx_peer_connection_t *pc, void *data) - 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) -diff --git a/src/http/modules/ngx_http_upstream_ip_hash_module.c b/src/http/modules/ngx_http_upstream_ip_hash_module.c -index 148d73a..913e395 100644 ---- a/src/http/modules/ngx_http_upstream_ip_hash_module.c -+++ b/src/http/modules/ngx_http_upstream_ip_hash_module.c -@@ -9,6 +9,9 @@ - #include - #include - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+#include "ngx_http_upstream_check_module.h" -+#endif - - typedef struct { - /* the round robin data must be first */ -@@ -212,6 +215,15 @@ ngx_http_upstream_get_ip_hash_peer(ngx_peer_connection_t *pc, void *data) - goto next_try; - } - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, -+ "get ip_hash peer, check_index: %ui", -+ peer->check_index); -+ if (ngx_http_upstream_check_peer_down(peer->check_index)) { -+ goto next_try; -+ } -+#endif -+ - if (peer->max_fails - && peer->fails >= peer->max_fails - && now - peer->checked <= peer->fail_timeout) -diff --git a/src/http/modules/ngx_http_upstream_least_conn_module.c b/src/http/modules/ngx_http_upstream_least_conn_module.c -index dbef95d..bbabb68 100644 ---- a/src/http/modules/ngx_http_upstream_least_conn_module.c -+++ b/src/http/modules/ngx_http_upstream_least_conn_module.c -@@ -9,6 +9,9 @@ - #include - #include - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+#include "ngx_http_upstream_check_module.h" -+#endif - - typedef struct { - ngx_uint_t *conns; -@@ -203,6 +206,16 @@ ngx_http_upstream_get_least_conn_peer(ngx_peer_connection_t *pc, void *data) - continue; - } - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, -+ "get least_conn peer, check_index: %ui", -+ peer->check_index); -+ -+ if (ngx_http_upstream_check_peer_down(peer->check_index)) { -+ continue; -+ } -+#endif -+ - if (peer->max_fails - && peer->fails >= peer->max_fails - && now - peer->checked <= peer->fail_timeout) -@@ -256,6 +269,16 @@ ngx_http_upstream_get_least_conn_peer(ngx_peer_connection_t *pc, void *data) - continue; - } - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, -+ "get least_conn peer, check_index: %ui", -+ peer->check_index); -+ -+ if (ngx_http_upstream_check_peer_down(peer->check_index)) { -+ continue; -+ } -+#endif -+ - if (lcp->conns[i] * best->weight != lcp->conns[p] * peer->weight) { - continue; - } -diff --git a/src/http/ngx_http_upstream_round_robin.c b/src/http/ngx_http_upstream_round_robin.c -index 37c835c..54aa44d 100644 ---- a/src/http/ngx_http_upstream_round_robin.c -+++ b/src/http/ngx_http_upstream_round_robin.c -@@ -9,6 +9,9 @@ - #include - #include - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+#include "ngx_http_upstream_check_module.h" -+#endif - - static ngx_http_upstream_rr_peer_t *ngx_http_upstream_get_peer( - ngx_http_upstream_rr_peer_data_t *rrp); -@@ -88,6 +91,14 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf, - peer[n].fail_timeout = server[i].fail_timeout; - peer[n].down = server[i].down; - peer[n].server = server[i].name; -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ if (!server[i].down) { -+ peers->peer[n].check_index = -+ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]); -+ } else { -+ peers->peer[n].check_index = (ngx_uint_t) NGX_ERROR; -+ } -+#endif - n++; - } - } -@@ -144,6 +155,15 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf, - peer[n].fail_timeout = server[i].fail_timeout; - peer[n].down = server[i].down; - peer[n].server = server[i].name; -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ if (!server[i].down) { -+ backup->peer[n].check_index = -+ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]); -+ } -+ else { -+ backup->peer[n].check_index = (ngx_uint_t) NGX_ERROR; -+ } -+#endif - n++; - } - } -@@ -203,6 +223,9 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf, - peer[i].current_weight = 0; - peer[i].max_fails = 1; - peer[i].fail_timeout = 10; -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR; -+#endif - } - - us->peer.data = peers; -@@ -312,7 +335,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r, - peer[0].current_weight = 0; - peer[0].max_fails = 1; - peer[0].fail_timeout = 10; -- -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ peers->peer[0].check_index = (ngx_uint_t) NGX_ERROR; -+#endif - } else { - - for (i = 0; i < ur->naddrs; i++) { -@@ -352,6 +377,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r, - peer[i].current_weight = 0; - peer[i].max_fails = 1; - peer[i].fail_timeout = 10; -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR; -+#endif - } - } - -@@ -411,6 +439,12 @@ ngx_http_upstream_get_round_robin_peer(ngx_peer_connection_t *pc, void *data) - goto failed; - } - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ if (ngx_http_upstream_check_peer_down(peer->check_index)) { -+ goto failed; -+ } -+#endif -+ - } else { - - /* there are several peers */ -@@ -508,6 +542,12 @@ ngx_http_upstream_get_peer(ngx_http_upstream_rr_peer_data_t *rrp) - continue; - } - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ if (ngx_http_upstream_check_peer_down(peer->check_index)) { -+ continue; -+ } -+#endif -+ - if (peer->max_fails - && peer->fails >= peer->max_fails - && now - peer->checked <= peer->fail_timeout) -diff --git a/src/http/ngx_http_upstream_round_robin.h b/src/http/ngx_http_upstream_round_robin.h -index 9db82a6..6e19a65 100644 ---- a/src/http/ngx_http_upstream_round_robin.h -+++ b/src/http/ngx_http_upstream_round_robin.h -@@ -31,6 +31,10 @@ typedef struct { - ngx_uint_t max_fails; - time_t fail_timeout; - -+#if (NGX_HTTP_UPSTREAM_CHECK) -+ ngx_uint_t check_index; -+#endif -+ - ngx_uint_t down; /* unsigned down:1; */ - - #if (NGX_HTTP_SSL)