# HG changeset patch # User Igor Sysoev # Date 1168534650 0 # Node ID 11ffb8e4753fca0bb8aa42933b3cace99d93c0e4 # Parent 19118c44303f98450fc47e97ef28abd2cb82e02a stop rbtree search early if equal hash was found diff --git a/src/http/modules/ngx_http_limit_zone_module.c b/src/http/modules/ngx_http_limit_zone_module.c --- a/src/http/modules/ngx_http_limit_zone_module.c +++ b/src/http/modules/ngx_http_limit_zone_module.c @@ -173,7 +173,9 @@ ngx_http_limit_zone_handler(ngx_http_req continue; } - if (hash == node->key ){ + /* hash == node->key */ + + do { lz = (ngx_http_limit_zone_node_t *) &node->color; if (len == (size_t) lz->len @@ -188,7 +190,12 @@ ngx_http_limit_zone_handler(ngx_http_req return NGX_HTTP_SERVICE_UNAVAILABLE; } - } + + node = node->right; + + } while (node != sentinel && hash == node->key); + + break; } n = offsetof(ngx_rbtree_node_t, color)