]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Clean up last patch; implement (mostly) proper handling for verified/unverified name...
authorNick Mathewson <nickm@torproject.org>
Tue, 17 Aug 2004 06:06:05 +0000 (06:06 +0000)
committerNick Mathewson <nickm@torproject.org>
Tue, 17 Aug 2004 06:06:05 +0000 (06:06 +0000)
svn:r2248

src/or/or.h
src/or/routerlist.c
src/or/routerparse.c

index 19cb7ea149057fd8f6cfa73e14afc34d3ff1518e..a0c1a7c11386959448697961ad72d298625fd667 100644 (file)
@@ -588,7 +588,7 @@ typedef struct {
   uint32_t bandwidthcapacity;
   struct exit_policy_t *exit_policy; /**< What streams will this OR permit
                                       * to exit? */
-  int uptime; /**< How many seconds the router claims to have been up */
+  long uptime; /**< How many seconds the router claims to have been up */
   /* local info */
   int is_running; /**< As far as we know, is this OR currently running? */
   time_t status_set_at; /**< When did we last update is_running? */
index 02e4b1836bfb9cfcd2167e308417028f0bb61237..dc8b0c10549dd06998bef732b3c2cf8fea58bc81 100644 (file)
@@ -565,6 +565,23 @@ int router_add_to_routerlist(routerinfo_t *router) {
         routerinfo_free(router);
         return -1;
       }
+    } else if (!strcmp(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
+         * there are more old unverifed routers with this nickname
+         */
+        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'",
+               router->nickname);
+        routerinfo_free(router);
+        return -1;
+      }
     }
   }
   /* We haven't seen a router with this name before.  Add it to the end of
index 7ee2512d6d2bb0949cfca1ca9f7ba85006a3b467..f3e6a53f8080419390bde83c65a9d6b61c14b58d 100644 (file)
@@ -644,7 +644,6 @@ routerinfo_t *router_parse_entry_from_string(const char *s,
   smartlist_t *tokens = NULL, *exit_policy_tokens = NULL;
   directory_token_t *tok;
   int t;
-  long lng;
   int ports_set, bw_set;
 
   if (!end) {