diff options
author | Roger Dingledine <arma@torproject.org> | 2009-06-20 01:52:59 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2009-06-30 10:10:13 -0400 |
commit | bdca5476daa900813fcc3ad04b3e952dcaddc994 (patch) | |
tree | cffbe92fe669a74a80148c7531f0643d79b93b4e | |
parent | 0cd16c4ad3aee87c385d62f9af7af64a7a99335c (diff) | |
download | tor-bdca5476daa900813fcc3ad04b3e952dcaddc994.tar.gz tor-bdca5476daa900813fcc3ad04b3e952dcaddc994.zip |
the second piece of bug 969 fixing
whenever we remove a relay from the main routerlist, tell the
rephist module that it's no longer running.
-rw-r--r-- | src/or/dirserv.c | 2 | ||||
-rw-r--r-- | src/or/or.h | 3 | ||||
-rw-r--r-- | 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 55c3302c6e..a64a01bb80 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 f84485f2f4..f37b417fe5 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 392b07b629..42b385b101 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--; } } |