mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 12:23:32 +01:00
r12535@Kushana: nickm | 2007-03-11 16:34:40 -0400
Fix a comment and add a couple of assert to try to track down another assert in routerlist_assert_ok() svn:r9799
This commit is contained in:
parent
f25e2167f5
commit
98c3403ce7
@ -1591,11 +1591,16 @@ _routerlist_find_elt(smartlist_t *sl, void *ri, int idx)
|
||||
}
|
||||
|
||||
/** Insert an item <b>ri</b> into the routerlist <b>rl</b>, updating indices
|
||||
* as needed. */
|
||||
* as needed. There must be no previous member of <b>rl</b> with the same
|
||||
* identity giest as <b>ri</b>: If there is, call routerlist_replace
|
||||
* instead.
|
||||
*/
|
||||
static void
|
||||
routerlist_insert(routerlist_t *rl, routerinfo_t *ri)
|
||||
{
|
||||
digestmap_set(rl->identity_map, ri->cache_info.identity_digest, ri);
|
||||
routerinfo_t *ri_old;
|
||||
ri_old = digestmap_set(rl->identity_map, ri->cache_info.identity_digest, ri);
|
||||
tor_assert(!ri_old);
|
||||
digestmap_set(rl->desc_digest_map, ri->cache_info.signed_descriptor_digest,
|
||||
&(ri->cache_info));
|
||||
smartlist_add(rl->routers, ri);
|
||||
@ -1684,6 +1689,7 @@ static void
|
||||
routerlist_replace(routerlist_t *rl, routerinfo_t *ri_old,
|
||||
routerinfo_t *ri_new, int idx, int make_old)
|
||||
{
|
||||
routerinfo_t *ri_tmp;
|
||||
tor_assert(ri_old != ri_new);
|
||||
idx = _routerlist_find_elt(rl->routers, ri_old, idx);
|
||||
router_dir_info_changed();
|
||||
@ -1701,7 +1707,9 @@ routerlist_replace(routerlist_t *rl, routerinfo_t *ri_old,
|
||||
/* digests don't match; digestmap_set won't replace */
|
||||
digestmap_remove(rl->identity_map, ri_old->cache_info.identity_digest);
|
||||
}
|
||||
digestmap_set(rl->identity_map, ri_new->cache_info.identity_digest, ri_new);
|
||||
ri_tmp = digestmap_set(rl->identity_map,
|
||||
ri_new->cache_info.identity_digest, ri_new);
|
||||
tor_assert(!ri_tmp);
|
||||
digestmap_set(rl->desc_digest_map,
|
||||
ri_new->cache_info.signed_descriptor_digest, &(ri_new->cache_info));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user