Mercurial > hg > nginx
comparison src/core/ngx_open_file_cache.c @ 4515:8bb695c05870 stable-1.0
Merge of r4498:
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, 05 Mar 2012 13:17:56 +0000 |
parents | 4919fb357a5d |
children |
comparison
equal
deleted
inserted
replaced
4514:79142134d616 | 4515:8bb695c05870 |
---|---|
835 continue; | 835 continue; |
836 } | 836 } |
837 | 837 |
838 /* hash == node->key */ | 838 /* hash == node->key */ |
839 | 839 |
840 do { | 840 file = (ngx_cached_open_file_t *) node; |
841 file = (ngx_cached_open_file_t *) node; | 841 |
842 | 842 rc = ngx_strcmp(name->data, file->name); |
843 rc = ngx_strcmp(name->data, file->name); | 843 |
844 | 844 if (rc == 0) { |
845 if (rc == 0) { | 845 return file; |
846 return file; | 846 } |
847 } | 847 |
848 | 848 node = (rc < 0) ? node->left : node->right; |
849 node = (rc < 0) ? node->left : node->right; | |
850 | |
851 } while (node != sentinel && hash == node->key); | |
852 | |
853 break; | |
854 } | 849 } |
855 | 850 |
856 return NULL; | 851 return NULL; |
857 } | 852 } |
858 | 853 |