aboutsummaryrefslogtreecommitdiff
path: root/src/or/routerlist.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-11-07 17:29:16 +0000
committerNick Mathewson <nickm@torproject.org>2007-11-07 17:29:16 +0000
commit9b2d86d83d198d5796e80a8cfbeb36b8892f8dfc (patch)
tree6b8e5367f1688e51f31f906b7e84f2bfd18f093a /src/or/routerlist.c
parentbed01a9003fe2923af3cb1e24f283c176500866f (diff)
downloadtor-9b2d86d83d198d5796e80a8cfbeb36b8892f8dfc.tar
tor-9b2d86d83d198d5796e80a8cfbeb36b8892f8dfc.tar.gz
r16527@catbus: nickm | 2007-11-07 12:27:59 -0500
Re-set all of the indices immediately after sorting old_routers. Fixes a crash. svn:r12413
Diffstat (limited to 'src/or/routerlist.c')
-rw-r--r--src/or/routerlist.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 11dabfe13..f51f7cf4e 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -2987,12 +2987,16 @@ routerlist_remove_old_routers(void)
goto done;
smartlist_sort(routerlist->old_routers, _compare_old_routers_by_identity);
+ /* Fix indices. */
+ for (i = 0; i < smartlist_len(routerlist_old_routers); ++i) {
+ signed_descriptor_t *r = smartlist_get(routerlist->old_routers, i);
+ r->routerlist_index = i;
+ }
/* Iterate through the list from back to front, so when we remove descriptors
* we don't mess up groups we haven't gotten to. */
for (i = smartlist_len(routerlist->old_routers)-1; i >= 0; --i) {
signed_descriptor_t *r = smartlist_get(routerlist->old_routers, i);
- r->routerlist_index = i;
if (!cur_id) {
cur_id = r->identity_digest;
hi = i;