r13144@catbus: nickm | 2007-06-02 08:44:42 -0400

Add some asserts to catch double-insert on routerlist.


svn:r10445
This commit is contained in:
Nick Mathewson 2007-06-02 12:44:57 +00:00
parent 5b6d7f10f3
commit 2ef3e7853b

View File

@ -1893,6 +1893,7 @@ routerlist_insert(routerlist_t *rl, routerinfo_t *ri)
routerinfo_t *ri_generated = router_get_my_routerinfo();
tor_assert(ri_generated != ri);
}
tor_assert(ri->routerlist_index == -1);
ri_old = digestmap_set(rl->identity_map, ri->cache_info.identity_digest, ri);
tor_assert(!ri_old);
@ -1981,6 +1982,8 @@ routerlist_insert_old(routerlist_t *rl, routerinfo_t *ri)
routerinfo_t *ri_generated = router_get_my_routerinfo();
tor_assert(ri_generated != ri);
}
tor_assert(ri->routerlist_index == -1);
if (get_options()->DirPort &&
ri->purpose == ROUTER_PURPOSE_GENERAL &&
!digestmap_get(rl->desc_digest_map,
@ -2113,6 +2116,8 @@ routerlist_replace(routerlist_t *rl, routerinfo_t *ri_old,
tor_assert(ri_generated != ri_new);
}
tor_assert(ri_old != ri_new);
tor_assert(ri_new->routerlist_index == -1);
idx = _routerlist_find_elt(rl->routers, ri_old, idx);
router_dir_info_changed();
if (idx >= 0) {