[or-cvs] r9640: if we can't read bandwidthrate, at least tell us what it was (tor/trunk/src/or)

arma at seul.org arma at seul.org
Sat Feb 24 19:29:48 UTC 2007


Author: arma
Date: 2007-02-24 14:29:42 -0500 (Sat, 24 Feb 2007)
New Revision: 9640

Modified:
   tor/trunk/src/or/routerparse.c
Log:
if we can't read bandwidthrate, at least tell us what it was.


Modified: tor/trunk/src/or/routerparse.c
===================================================================
--- tor/trunk/src/or/routerparse.c	2007-02-24 19:10:35 UTC (rev 9639)
+++ tor/trunk/src/or/routerparse.c	2007-02-24 19:29:42 UTC (rev 9640)
@@ -814,10 +814,19 @@
     }
     router->bandwidthrate =
       tor_parse_long(tok->args[0],10,0,INT_MAX,NULL,NULL);
+
+    if (!router->bandwidthrate) {
+      log_warn(LD_DIR, "bandwidthrate %s unreadable or 0. Failing.",
+               escaped(tok->args[0]));
+      goto err;
+    }
+
     router->bandwidthburst =
       tor_parse_long(tok->args[1],10,0,INT_MAX,NULL,NULL);
     router->bandwidthcapacity =
       tor_parse_long(tok->args[2],10,0,INT_MAX,NULL,NULL);
+
+    /* XXX we don't error-check these values? -RD */
   }
 
   if ((tok = find_first_by_keyword(tokens, K_UPTIME))) {
@@ -953,10 +962,7 @@
     log_warn(LD_DIR,"or_port unreadable or 0. Failing.");
     goto err;
   }
-  if (!router->bandwidthrate) {
-    log_warn(LD_DIR,"bandwidthrate unreadable or 0. Failing.");
-    goto err;
-  }
+
   if (!router->platform) {
     router->platform = tor_strdup("<unknown>");
   }



More information about the tor-commits mailing list