Mercurial > hg > nginx-quic
comparison src/http/modules/ngx_http_limit_conn_module.c @ 4497:95ab6658654a
Fix of rbtree lookup on hash collisions.
Previous code incorrectly assumed that nodes with identical keys are linked
together. This might not be true after tree rebalance.
Patch by Lanshun Zhou.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 27 Feb 2012 22:15:39 +0000 |
parents | 2d4ff8bd5649 |
children | 778ef9c3fd2d |
comparison
equal
deleted
inserted
replaced
4496:be6c250b827b | 4497:95ab6658654a |
---|---|
323 continue; | 323 continue; |
324 } | 324 } |
325 | 325 |
326 /* hash == node->key */ | 326 /* hash == node->key */ |
327 | 327 |
328 do { | 328 lcn = (ngx_http_limit_conn_node_t *) &node->color; |
329 lcn = (ngx_http_limit_conn_node_t *) &node->color; | 329 |
330 | 330 rc = ngx_memn2cmp(vv->data, lcn->data, |
331 rc = ngx_memn2cmp(vv->data, lcn->data, | 331 (size_t) vv->len, (size_t) lcn->len); |
332 (size_t) vv->len, (size_t) lcn->len); | 332 if (rc == 0) { |
333 if (rc == 0) { | 333 return node; |
334 return node; | 334 } |
335 } | 335 |
336 | 336 node = (rc < 0) ? node->left : node->right; |
337 node = (rc < 0) ? node->left : node->right; | |
338 | |
339 } while (node != sentinel && hash == node->key); | |
340 | |
341 break; | |
342 } | 337 } |
343 | 338 |
344 return NULL; | 339 return NULL; |
345 } | 340 } |
346 | 341 |