Mercurial > hg > nginx
comparison src/http/modules/ngx_http_limit_zone_module.c @ 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 | 38be15c1379a |
comparison
equal
deleted
inserted
replaced
1011:19118c44303f | 1012:11ffb8e4753f |
---|---|
171 if (hash > node->key) { | 171 if (hash > node->key) { |
172 node = node->right; | 172 node = node->right; |
173 continue; | 173 continue; |
174 } | 174 } |
175 | 175 |
176 if (hash == node->key ){ | 176 /* hash == node->key */ |
177 | |
178 do { | |
177 lz = (ngx_http_limit_zone_node_t *) &node->color; | 179 lz = (ngx_http_limit_zone_node_t *) &node->color; |
178 | 180 |
179 if (len == (size_t) lz->len | 181 if (len == (size_t) lz->len |
180 && ngx_strncmp(lz->data, vv->data, len) == 0) | 182 && ngx_strncmp(lz->data, vv->data, len) == 0) |
181 { | 183 { |
186 | 188 |
187 ngx_shmtx_unlock(&shpool->mutex); | 189 ngx_shmtx_unlock(&shpool->mutex); |
188 | 190 |
189 return NGX_HTTP_SERVICE_UNAVAILABLE; | 191 return NGX_HTTP_SERVICE_UNAVAILABLE; |
190 } | 192 } |
191 } | 193 |
194 node = node->right; | |
195 | |
196 } while (node != sentinel && hash == node->key); | |
197 | |
198 break; | |
192 } | 199 } |
193 | 200 |
194 n = offsetof(ngx_rbtree_node_t, color) | 201 n = offsetof(ngx_rbtree_node_t, color) |
195 + offsetof(ngx_http_limit_zone_node_t, data) | 202 + offsetof(ngx_http_limit_zone_node_t, data) |
196 + len; | 203 + len; |