Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 503414
Collapse All | Expand All

(-)a/src/http/modules/ngx_http_upstream_ip_hash_module.c (+13 lines)
Lines 9-14 Link Here
9
#include <ngx_core.h>
9
#include <ngx_core.h>
10
#include <ngx_http.h>
10
#include <ngx_http.h>
11
11
12
#if (NGX_UPSTREAM_CHECK_MODULE)
13
#include "ngx_http_upstream_check_handler.h"
14
#endif
15
12
16
13
typedef struct {
17
typedef struct {
14
    /* the round robin data must be first */
18
    /* the round robin data must be first */
Lines 212-217 ngx_http_upstream_get_ip_hash_peer(ngx_peer_connection_t *pc, void *data) Link Here
212
            goto next_try;
216
            goto next_try;
213
        }
217
        }
214
218
219
#if (NGX_UPSTREAM_CHECK_MODULE)
220
        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
221
                       "get ip_hash peer, check_index: %ui",
222
                       peer->check_index);
223
        if (ngx_http_check_peer_down(peer->check_index)) {
224
            goto next_try;
225
        }
226
#endif
227
215
        if (peer->max_fails
228
        if (peer->max_fails
216
            && peer->fails >= peer->max_fails
229
            && peer->fails >= peer->max_fails
217
            && now - peer->checked <= peer->fail_timeout)
230
            && now - peer->checked <= peer->fail_timeout)
(-)a/src/http/modules/ngx_http_upstream_least_conn_module.c (+24 lines)
Lines 9-14 Link Here
9
#include <ngx_core.h>
9
#include <ngx_core.h>
10
#include <ngx_http.h>
10
#include <ngx_http.h>
11
11
12
#if (NGX_UPSTREAM_CHECK_MODULE)
13
#include "ngx_http_upstream_check_handler.h"
14
#endif
15
12
16
13
typedef struct {
17
typedef struct {
14
    ngx_uint_t                        *conns;
18
    ngx_uint_t                        *conns;
Lines 203-208 ngx_http_upstream_get_least_conn_peer(ngx_peer_connection_t *pc, void *data) Link Here
203
            continue;
207
            continue;
204
        }
208
        }
205
209
210
#if (NGX_UPSTREAM_CHECK_MODULE)
211
        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
212
                "get least_conn peer, check_index: %ui",
213
                peer->check_index);
214
215
        if (ngx_http_check_peer_down(peer->check_index)) {
216
            continue;
217
        }
218
#endif
219
206
        if (peer->max_fails
220
        if (peer->max_fails
207
            && peer->fails >= peer->max_fails
221
            && peer->fails >= peer->max_fails
208
            && now - peer->checked <= peer->fail_timeout)
222
            && now - peer->checked <= peer->fail_timeout)
Lines 256-261 ngx_http_upstream_get_least_conn_peer(ngx_peer_connection_t *pc, void *data) Link Here
256
                continue;
270
                continue;
257
            }
271
            }
258
272
273
#if (NGX_UPSTREAM_CHECK_MODULE)
274
            ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
275
                    "get least_conn peer, check_index: %ui",
276
                    peer->check_index);
277
278
            if (ngx_http_check_peer_down(peer->check_index)) {
279
                continue;
280
            }
281
#endif
282
259
            if (lcp->conns[i] * best->weight != lcp->conns[p] * peer->weight) {
283
            if (lcp->conns[i] * best->weight != lcp->conns[p] * peer->weight) {
260
                continue;
284
                continue;
261
            }
285
            }
(-)a/src/http/ngx_http_upstream_round_robin.c (+45 lines)
Lines 9-14 Link Here
9
#include <ngx_core.h>
9
#include <ngx_core.h>
10
#include <ngx_http.h>
10
#include <ngx_http.h>
11
11
12
#if (NGX_UPSTREAM_CHECK_MODULE)
13
#include "ngx_http_upstream_check_handler.h"
14
#endif
12
15
13
static ngx_http_upstream_rr_peer_t *ngx_http_upstream_get_peer(
16
static ngx_http_upstream_rr_peer_t *ngx_http_upstream_get_peer(
14
    ngx_http_upstream_rr_peer_data_t *rrp);
17
    ngx_http_upstream_rr_peer_data_t *rrp);
Lines 85-90 ngx_http_upstream_init_round_robin(ngx_conf_t *cf, Link Here
85
                peers->peer[n].max_fails = server[i].max_fails;
88
                peers->peer[n].max_fails = server[i].max_fails;
86
                peers->peer[n].fail_timeout = server[i].fail_timeout;
89
                peers->peer[n].fail_timeout = server[i].fail_timeout;
87
                peers->peer[n].down = server[i].down;
90
                peers->peer[n].down = server[i].down;
91
92
#if (NGX_UPSTREAM_CHECK_MODULE)
93
                if (!server[i].down) {
94
                    peers->peer[n].check_index =
95
                        ngx_http_check_add_peer(cf, us, &server[i].addrs[j]);
96
                }
97
                else {
98
                    peers->peer[n].check_index = (ngx_uint_t) NGX_ERROR;
99
                }
100
#endif
88
                n++;
101
                n++;
89
            }
102
            }
90
        }
103
        }
Lines 139-144 ngx_http_upstream_init_round_robin(ngx_conf_t *cf, Link Here
139
                backup->peer[n].max_fails = server[i].max_fails;
152
                backup->peer[n].max_fails = server[i].max_fails;
140
                backup->peer[n].fail_timeout = server[i].fail_timeout;
153
                backup->peer[n].fail_timeout = server[i].fail_timeout;
141
                backup->peer[n].down = server[i].down;
154
                backup->peer[n].down = server[i].down;
155
156
#if (NGX_UPSTREAM_CHECK_MODULE)
157
                if (!server[i].down) {
158
                    backup->peer[n].check_index =
159
                        ngx_http_check_add_peer(cf, us, &server[i].addrs[j]);
160
                }
161
                else {
162
                    backup->peer[n].check_index = (ngx_uint_t) NGX_ERROR;
163
                }
164
#endif
165
142
                n++;
166
                n++;
143
            }
167
            }
144
        }
168
        }
Lines 196-201 ngx_http_upstream_init_round_robin(ngx_conf_t *cf, Link Here
196
        peers->peer[i].current_weight = 0;
220
        peers->peer[i].current_weight = 0;
197
        peers->peer[i].max_fails = 1;
221
        peers->peer[i].max_fails = 1;
198
        peers->peer[i].fail_timeout = 10;
222
        peers->peer[i].fail_timeout = 10;
223
#if (NGX_UPSTREAM_CHECK_MODULE)
224
        peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR;
225
#endif
199
    }
226
    }
200
227
201
    us->peer.data = peers;
228
    us->peer.data = peers;
Lines 302-307 ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r, Link Here
302
        peers->peer[0].current_weight = 0;
329
        peers->peer[0].current_weight = 0;
303
        peers->peer[0].max_fails = 1;
330
        peers->peer[0].max_fails = 1;
304
        peers->peer[0].fail_timeout = 10;
331
        peers->peer[0].fail_timeout = 10;
332
#if (NGX_UPSTREAM_CHECK_MODULE)
333
        peers->peer[0].check_index = (ngx_uint_t) NGX_ERROR;
334
#endif
305
335
306
    } else {
336
    } else {
307
337
Lines 342-347 ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r, Link Here
342
            peers->peer[i].current_weight = 0;
372
            peers->peer[i].current_weight = 0;
343
            peers->peer[i].max_fails = 1;
373
            peers->peer[i].max_fails = 1;
344
            peers->peer[i].fail_timeout = 10;
374
            peers->peer[i].fail_timeout = 10;
375
#if (NGX_UPSTREAM_CHECK_MODULE)
376
            peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR;
377
#endif
345
        }
378
        }
346
    }
379
    }
347
380
Lines 399-404 ngx_http_upstream_get_round_robin_peer(ngx_peer_connection_t *pc, void *data) Link Here
399
            goto failed;
432
            goto failed;
400
        }
433
        }
401
434
435
#if (NGX_UPSTREAM_CHECK_MODULE)
436
        if (ngx_http_check_peer_down(peer->check_index)) {
437
            goto failed;
438
        }
439
#endif
440
402
    } else {
441
    } else {
403
442
404
        /* there are several peers */
443
        /* there are several peers */
Lines 498-503 ngx_http_upstream_get_peer(ngx_http_upstream_rr_peer_data_t *rrp) Link Here
498
            continue;
537
            continue;
499
        }
538
        }
500
539
540
#if (NGX_UPSTREAM_CHECK_MODULE)
541
        if (ngx_http_check_peer_down(peer->check_index)) {
542
            continue;
543
        }
544
#endif
545
501
        if (peer->max_fails
546
        if (peer->max_fails
502
            && peer->fails >= peer->max_fails
547
            && peer->fails >= peer->max_fails
503
            && now - peer->checked <= peer->fail_timeout)
548
            && now - peer->checked <= peer->fail_timeout)
(-)a/src/http/ngx_http_upstream_round_robin.h (+4 lines)
Lines 30-35 typedef struct { Link Here
30
    ngx_uint_t                      max_fails;
30
    ngx_uint_t                      max_fails;
31
    time_t                          fail_timeout;
31
    time_t                          fail_timeout;
32
32
33
#if (NGX_UPSTREAM_CHECK_MODULE)
34
    ngx_uint_t                      check_index;
35
#endif
36
33
    ngx_uint_t                      down;          /* unsigned  down:1; */
37
    ngx_uint_t                      down;          /* unsigned  down:1; */
34
38
35
#if (NGX_HTTP_SSL)
39
#if (NGX_HTTP_SSL)

Return to bug 503414