changeset 1012:11ffb8e4753f

stop rbtree search early if equal hash was found
author Igor Sysoev <igor@sysoev.ru>
date Thu, 11 Jan 2007 16:57:30 +0000
parents 19118c44303f
children 7dd987e09701
files src/http/modules/ngx_http_limit_zone_module.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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)