summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-08-17 08:00:23 +0000
committerRoger Dingledine <arma@torproject.org>2004-08-17 08:00:23 +0000
commitaa1e5184460071b6930ebcddbced49425a045b41 (patch)
treeb11c635ccdab37b62b0da24ba354a3d0d82e701e
parent4e026f5b1d4c00c8c85528f8ac0cfa7c2234cd04 (diff)
downloadtor-aa1e5184460071b6930ebcddbced49425a045b41.tar.gz
tor-aa1e5184460071b6930ebcddbced49425a045b41.zip
when a verified routerinfo arrives with a new key than the previous
verified routerinfo with that name, close connections to the obsolete key to make way for connections to the new key. svn:r2257
-rw-r--r--src/or/routerlist.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 149897ff9f..a8817e8767 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -566,16 +566,24 @@ int router_add_to_routerlist(routerinfo_t *router) {
routerinfo_free(router);
return -1;
}
- } else if (!strcmp(router->nickname, r->nickname)) {
+ } else if (!strcasecmp(router->nickname, r->nickname)) {
/* nicknames match, keys don't. */
if (router->is_verified) {
/* The new verified router replaces the old one; remove the
- * old one. and carry on to the end of the list, in case
+ * old one. And carry on to the end of the list, in case
* there are more old unverifed routers with this nickname
*/
+ /* mark-for-close connections using the old key, so we can
+ * make new ones with the new key.
+ */
+ connection_t *conn;
+ while((conn = connection_get_by_identity_digest(r->identity_digest,
+ CONN_TYPE_OR))) {
+ log_fn(LOG_INFO,"Closing conn to obsolete router '%s'", r->nickname);
+ connection_mark_for_close(conn);
+ }
routerinfo_free(r);
smartlist_del_keeporder(routerlist->routers, i--);
- /* XXXX What do we do about any connections using the old key? */
} else if (r->is_verified) {
/* Can't replace a verified router with an unverified one. */
log_fn(LOG_DEBUG, "Skipping unverified entry for verified router '%s'",