[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] [tor/maint-0.2.1] the second piece of bug 969 fixing
Author: Roger Dingledine <arma@xxxxxxxxxxxxxx>
Date: Sat, 20 Jun 2009 01:52:59 -0400
Subject: the second piece of bug 969 fixing
Commit: bdca5476daa900813fcc3ad04b3e952dcaddc994
whenever we remove a relay from the main routerlist, tell the
rephist module that it's no longer running.
---
src/or/dirserv.c | 2 +-
src/or/or.h | 3 ++-
src/or/routerlist.c | 7 +++++--
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 55c3302..a64a01b 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -797,7 +797,7 @@ directory_remove_invalid(void)
if (r & FP_REJECT) {
log_info(LD_DIRSERV, "Router '%s' is now rejected: %s",
ent->nickname, msg?msg:"");
- routerlist_remove(rl, ent, 0);
+ routerlist_remove(rl, ent, 0, time(NULL));
i--;
changed = 1;
continue;
diff --git a/src/or/or.h b/src/or/or.h
index f84485f..f37b417 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -4411,7 +4411,8 @@ void routerinfo_free(routerinfo_t *router);
void extrainfo_free(extrainfo_t *extrainfo);
void routerlist_free(routerlist_t *rl);
void dump_routerlist_mem_usage(int severity);
-void routerlist_remove(routerlist_t *rl, routerinfo_t *ri, int make_old);
+void routerlist_remove(routerlist_t *rl, routerinfo_t *ri, int make_old,
+ time_t now);
void routerlist_free_all(void);
void routerlist_reset_warnings(void);
void router_set_status(const char *digest, int up);
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 392b07b..42b385b 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -2629,7 +2629,7 @@ routerlist_insert_old(routerlist_t *rl, routerinfo_t *ri)
* If <b>make_old</b> is true, instead of deleting the router, we try adding
* it to rl->old_routers. */
void
-routerlist_remove(routerlist_t *rl, routerinfo_t *ri, int make_old)
+routerlist_remove(routerlist_t *rl, routerinfo_t *ri, int make_old, time_t now)
{
routerinfo_t *ri_tmp;
extrainfo_t *ei_tmp;
@@ -2637,6 +2637,9 @@ routerlist_remove(routerlist_t *rl, routerinfo_t *ri, int make_old)
tor_assert(0 <= idx && idx < smartlist_len(rl->routers));
tor_assert(smartlist_get(rl->routers, idx) == ri);
+ /* make sure the rephist module knows that it's not running */
+ rep_hist_note_router_unreachable(ri->cache_info.identity_digest, now);
+
ri->cache_info.routerlist_index = -1;
smartlist_del(rl->routers, idx);
if (idx < smartlist_len(rl->routers)) {
@@ -3328,7 +3331,7 @@ routerlist_remove_old_routers(void)
log_info(LD_DIR,
"Forgetting obsolete (too old) routerinfo for router '%s'",
router->nickname);
- routerlist_remove(routerlist, router, 1);
+ routerlist_remove(routerlist, router, 1, now);
i--;
}
}
--
1.5.6.5