[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r10753: Remove two arguments from routerlist_replace(). idx, which i (tor/trunk/src/or)
Author: weasel
Date: 2007-07-06 14:40:39 -0400 (Fri, 06 Jul 2007)
New Revision: 10753
Modified:
tor/trunk/src/or/routerlist.c
Log:
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())
Modified: tor/trunk/src/or/routerlist.c
===================================================================
--- tor/trunk/src/or/routerlist.c 2007-07-06 18:20:54 UTC (rev 10752)
+++ tor/trunk/src/or/routerlist.c 2007-07-06 18:40:39 UTC (rev 10753)
@@ -2109,8 +2109,10 @@
* 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 @@
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 @@
&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 @@
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->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->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);
}