aboutsummaryrefslogtreecommitdiff
path: root/src/stream/ngx_stream_geo_module.c
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@nginx.com>2016-08-23 15:59:42 +0300
committerRuslan Ermilov <ru@nginx.com>2016-08-23 15:59:42 +0300
commit9208875db1d47d7bdc7b7b6583ea3b3b04b33a01 (patch)
tree3a7db11ef713eba1e5d8fe241003eedc8438930d /src/stream/ngx_stream_geo_module.c
parent20de5f14e5f7de68576bc20bce5cf53f615f7113 (diff)
downloadnginx-9208875db1d47d7bdc7b7b6583ea3b3b04b33a01.tar.gz
nginx-9208875db1d47d7bdc7b7b6583ea3b3b04b33a01.zip
Geo: fixed warnings when removing nonexistent ranges.
geo $geo { ranges; 10.0.0.0-10.0.0.255 test; delete 10.0.1.0-10.0.1.255; # should warn delete 10.0.0.0-10.0.0.255; delete 10.0.0.0-10.0.0.255; # should warn }
Diffstat (limited to 'src/stream/ngx_stream_geo_module.c')
-rw-r--r--src/stream/ngx_stream_geo_module.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/stream/ngx_stream_geo_module.c b/src/stream/ngx_stream_geo_module.c
index 5e91c46fb..220454631 100644
--- a/src/stream/ngx_stream_geo_module.c
+++ b/src/stream/ngx_stream_geo_module.c
@@ -940,7 +940,7 @@ ngx_stream_geo_delete_range(ngx_conf_t *cf, ngx_stream_geo_conf_ctx_t *ctx,
a = (ngx_array_t *) ctx->high.low[h];
- if (a == NULL) {
+ if (a == NULL || a->nelts == 0) {
warn = 1;
goto next;
}
@@ -959,13 +959,9 @@ ngx_stream_geo_delete_range(ngx_conf_t *cf, ngx_stream_geo_conf_ctx_t *ctx,
break;
}
- if (s != (ngx_uint_t) range[i].start
- && e != (ngx_uint_t) range[i].end)
- {
- continue;
+ if (i == a->nelts - 1) {
+ warn = 1;
}
-
- warn = 1;
}
next: