[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] when a verified routerinfo arrives with a new key than the ...



Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or

Modified Files:
	routerlist.c 
Log Message:
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.


Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerlist.c,v
retrieving revision 1.125
retrieving revision 1.126
diff -u -d -r1.125 -r1.126
--- routerlist.c	17 Aug 2004 06:42:30 -0000	1.125
+++ routerlist.c	17 Aug 2004 08:00:23 -0000	1.126
@@ -566,16 +566,24 @@
         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'",