Skip to content

Commit 1e9c386

Browse files
committed
applied the patch from Marcus Clyne to fix the nginx HUP issue of NDK's upstream_list facility.
1 parent 3967b60 commit 1e9c386

File tree

2 files changed

+6
-30
lines changed

2 files changed

+6
-30
lines changed

src/ngx_http_set_hashed_upstream.c

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,6 @@
44
#include "ngx_http_set_hashed_upstream.h"
55

66

7-
ndk_upstream_list_t *
8-
ngx_http_set_misc_get_upstream_list(u_char *data, size_t len)
9-
{
10-
ndk_upstream_list_t *ul, *ule;
11-
12-
if (ndk_upstreams == NULL) {
13-
return NULL;
14-
}
15-
16-
ul = ndk_upstreams->elts;
17-
ule = ul + ndk_upstreams->nelts;
18-
19-
for (; ul < ule; ul++) {
20-
if (ul->name.len == len &&
21-
ngx_strncasecmp(ul->name.data, data, len) == 0)
22-
{
23-
return ul;
24-
}
25-
}
26-
27-
return NULL;
28-
}
29-
307

318
ngx_uint_t
329
ngx_http_set_misc_apply_distribution(ngx_log_t *log, ngx_uint_t hash,
@@ -57,14 +34,15 @@ ngx_http_set_misc_set_hashed_upstream(ngx_http_request_t *r,
5734
ngx_str_t ulname;
5835
ngx_uint_t hash, index;
5936
ngx_http_variable_value_t *key;
60-
37+
6138
if (ul == NULL) {
6239
ulname.data = v->data;
6340
ulname.len = v->len;
6441

6542
dd("ulname: %.*s", ulname.len, ulname.data);
66-
67-
ul = ngx_http_set_misc_get_upstream_list(ulname.data, ulname.len);
43+
44+
ul = ndk_get_upstream_list(ndk_http_get_main_conf(r),
45+
ulname.data, ulname.len);
6846

6947
if (ul == NULL) {
7048
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
@@ -142,7 +120,8 @@ ngx_http_set_hashed_upstream(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
142120
return ndk_set_var_multi_value_core(cf, var, v, &filter);
143121
}
144122

145-
ul = ngx_http_set_misc_get_upstream_list(ulname->data, ulname->len);
123+
ul = ndk_get_upstream_list(ndk_http_conf_get_main_conf(cf),
124+
ulname->data, ulname->len);
146125
if (ul == NULL) {
147126
ngx_log_error(NGX_LOG_ERR, cf->log, 0,
148127
"set_hashed_upstream: upstream list \"%V\" "

src/ngx_http_set_hashed_upstream.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ typedef enum {
1414
} ngx_http_set_misc_distribution_t;
1515

1616

17-
ndk_upstream_list_t *
18-
ngx_http_set_misc_get_upstream_list(u_char *data, size_t len);
19-
2017
ngx_uint_t ngx_http_set_misc_apply_distribution(ngx_log_t *log, ngx_uint_t hash,
2118
ndk_upstream_list_t *ul, ngx_http_set_misc_distribution_t type);
2219

0 commit comments

Comments
 (0)