aboutsummaryrefslogtreecommitdiff
path: root/src/or/dirserv.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-11-22 12:30:33 -0500
committerNick Mathewson <nickm@torproject.org>2010-11-22 12:32:29 -0500
commitbea0a31c1c859a563f065d8b868570560abc5135 (patch)
tree3f47b0be5e10666cb719dee77c7ace802d0c11ad /src/or/dirserv.c
parent80357abb11023ff285c251ee75b864e0a27d5809 (diff)
downloadtor-bea0a31c1c859a563f065d8b868570560abc5135.tar.gz
tor-bea0a31c1c859a563f065d8b868570560abc5135.zip
Treat routers whose IPs have changed as having been down for MTBF/routerinfo
calculation purposes.
Diffstat (limited to 'src/or/dirserv.c')
-rw-r--r--src/or/dirserv.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 42d7d561ce..52e59cd9d1 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -3108,19 +3108,25 @@ dirserv_orconn_tls_done(const char *address,
tor_assert(address);
tor_assert(digest_rcvd);
- SMARTLIST_FOREACH(rl->routers, routerinfo_t *, ri, {
+ /* XXX023 Doing a loop like this is stupid. We should just look up the
+ * router by digest_rcvd, and see if address, orport, and as_advertised
+ * match up. -NM */
+ SMARTLIST_FOREACH_BEGIN(rl->routers, routerinfo_t *, ri) {
if (!strcasecmp(address, ri->address) && or_port == ri->or_port &&
as_advertised &&
!memcmp(ri->cache_info.identity_digest, digest_rcvd, DIGEST_LEN)) {
/* correct digest. mark this router reachable! */
if (!bridge_auth || ri->purpose == ROUTER_PURPOSE_BRIDGE) {
- log_info(LD_DIRSERV, "Found router %s to be reachable. Yay.",
- ri->nickname);
- rep_hist_note_router_reachable(digest_rcvd, now);
+ tor_addr_t addr, *addrp=NULL;
+ log_info(LD_DIRSERV, "Found router %s to be reachable at %s. Yay.",
+ ri->nickname, address);
+ if (tor_addr_from_str(&addr, ri->address) != -1)
+ addrp = &addr;
+ rep_hist_note_router_reachable(digest_rcvd, addrp, now);
ri->last_reachable = now;
}
}
- });
+ } SMARTLIST_FOREACH_END(ri);
/* FFFF Maybe we should reinstate the code that dumps routers with the same
* addr/port but with nonmatching keys, but instead of dumping, we should
* skip testing. */