mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
Remove two arguments from routerlist_replace(). idx, which is
the old router's index in the routerlist, can be gotten from the old routerinfo itself anyway, and make_old always was true. (There only is one caller of routerlist_replace()) svn:r10753
This commit is contained in:
parent
e6ba07f8f5
commit
39b1a11f8d
@ -2109,8 +2109,10 @@ routerlist_remove_old(routerlist_t *rl, signed_descriptor_t *sd, int idx)
|
||||
* it to rl->old_routers. */
|
||||
static void
|
||||
routerlist_replace(routerlist_t *rl, routerinfo_t *ri_old,
|
||||
routerinfo_t *ri_new, int idx, int make_old)
|
||||
routerinfo_t *ri_new)
|
||||
{
|
||||
int idx;
|
||||
|
||||
routerinfo_t *ri_tmp;
|
||||
extrainfo_t *ei_tmp;
|
||||
routerlist_check_bug_417();
|
||||
@ -2122,7 +2124,10 @@ routerlist_replace(routerlist_t *rl, routerinfo_t *ri_old,
|
||||
tor_assert(ri_old != ri_new);
|
||||
tor_assert(ri_new->routerlist_index == -1);
|
||||
|
||||
idx = _routerlist_find_elt(rl->routers, ri_old, idx);
|
||||
idx = ri_old->routerlist_index;
|
||||
tor_assert(0 <= idx && idx < smartlist_len(rl->routers));
|
||||
tor_assert(smartlist_get(rl->routers, idx) == ri_old);
|
||||
|
||||
router_dir_info_changed();
|
||||
if (idx >= 0) {
|
||||
smartlist_set(rl->routers, idx, ri_new);
|
||||
@ -2151,7 +2156,7 @@ routerlist_replace(routerlist_t *rl, routerinfo_t *ri_old,
|
||||
&ri_new->cache_info);
|
||||
}
|
||||
|
||||
if (make_old && get_options()->DirPort &&
|
||||
if (get_options()->DirPort &&
|
||||
ri_old->purpose == ROUTER_PURPOSE_GENERAL) {
|
||||
signed_descriptor_t *sd = signed_descriptor_from_routerinfo(ri_old);
|
||||
smartlist_add(rl->old_routers, sd);
|
||||
@ -2423,12 +2428,6 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
|
||||
old_router = rimap_get(routerlist->identity_map,
|
||||
router->cache_info.identity_digest);
|
||||
if (old_router) {
|
||||
int have_min_info = router_have_minimum_dir_info(); /* can mess with pos,
|
||||
* so call it now.*/
|
||||
int pos = old_router->routerlist_index;
|
||||
tor_assert(0 <= pos && pos < smartlist_len(routerlist->routers));
|
||||
tor_assert(smartlist_get(routerlist->routers, pos) == old_router);
|
||||
|
||||
if (router->cache_info.published_on <=
|
||||
old_router->cache_info.published_on) {
|
||||
/* Same key, but old */
|
||||
@ -2454,7 +2453,8 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
|
||||
router->num_unreachable_notifications =
|
||||
old_router->num_unreachable_notifications;
|
||||
}
|
||||
if (authdir && !from_cache && !from_fetch && have_min_info &&
|
||||
if (authdir && !from_cache && !from_fetch &&
|
||||
router_have_minimum_dir_info() &&
|
||||
dirserv_thinks_router_is_blatantly_unreachable(router, time(NULL))) {
|
||||
if (router->num_unreachable_notifications >= 3) {
|
||||
unreachable = 1;
|
||||
@ -2470,7 +2470,7 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
|
||||
router->num_unreachable_notifications++;
|
||||
}
|
||||
}
|
||||
routerlist_replace(routerlist, old_router, router, pos, 1);
|
||||
routerlist_replace(routerlist, old_router, router);
|
||||
if (!from_cache) {
|
||||
signed_desc_append_to_journal(&router->cache_info, router->purpose);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user