[or-cvs] require BandwidthRate to be at least 10kB/s

Roger Dingledine arma at seul.org
Fri Dec 31 21:47:56 UTC 2004


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

Modified Files:
	config.c or.h routerlist.c 
Log Message:
require BandwidthRate to be at least 10kB/s


Index: config.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/config.c,v
retrieving revision 1.287
retrieving revision 1.288
diff -u -d -r1.287 -r1.288
--- config.c	24 Dec 2004 20:45:45 -0000	1.287
+++ config.c	31 Dec 2004 21:47:54 -0000	1.288
@@ -217,15 +217,7 @@
 }
 
 /** Change the current global options to contain <b>new_val</b> instead
- * of their current value; free the old value as necessary.  Where
- * <b>new_val</b> is different from the old value, update the process to
- * use the new value instead.
- *
- * Note 1: <b>new_val</b> must have previously been validated with
- * options_validate(), or Tor may freak out and exit.
- *
- * Note 2: We haven't moved all the "act on new configuration" logic
- * here yet.  Some is still in do_hup() and other places.
+ * of their current value; free the old value as necessary.
  */
 void
 set_options(or_options_t *new_val) {
@@ -237,6 +229,12 @@
 /** Fetch the active option list, and take actions based on it. All
  * of the things we do should survive being done repeatedly.
  * Return 0 if all goes well, return -1 if it's time to die.
+ *
+ * Note 1: <b>new_val</b> must have previously been validated with
+ * options_validate(), or Tor may freak out and exit.
+ *
+ * Note 2: We haven't moved all the "act on new configuration" logic
+ * here yet.  Some is still in do_hup() and other places.
  */
 int
 options_act(void) {
@@ -1369,6 +1367,10 @@
     log(LOG_WARN,"BandwidthBurst must be less than %d",INT_MAX);
     result = -1;
   }
+  if (options->BandwidthRate < ROUTER_REQUIRED_MIN_BANDWIDTH) {
+    log(LOG_WARN,"BandwidthRate is set to %d bytes/second. It must be at least %d.", (int)options->BandwidthRate, ROUTER_REQUIRED_MIN_BANDWIDTH);
+    result = -1;
+  }
 
   if (options->_MonthlyAccountingStart) {
     if (options->AccountingStart) {

Index: or.h
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.511
retrieving revision 1.512
diff -u -d -r1.511 -r1.512
--- or.h	24 Dec 2004 02:17:32 -0000	1.511
+++ or.h	31 Dec 2004 21:47:54 -0000	1.512
@@ -1579,6 +1579,13 @@
 int router_nickname_is_in_list(routerinfo_t *router, const char *list);
 routerinfo_t *routerlist_find_my_routerinfo(void);
 int router_nickname_matches(routerinfo_t *router, const char *nickname);
+
+/** How many seconds a router must be up before we'll use it for
+ * reliability-critical node positions.
+ */
+#define ROUTER_REQUIRED_MIN_UPTIME 3600 /* an hour */
+#define ROUTER_REQUIRED_MIN_BANDWIDTH 10000
+
 int router_is_unreliable_router(routerinfo_t *router, int need_uptime, int need_bw);
 routerinfo_t *routerlist_sl_choose_by_bandwidth(smartlist_t *sl);
 routerinfo_t *router_choose_random_node(const char *preferred,

Index: routerlist.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/routerlist.c,v
retrieving revision 1.200
retrieving revision 1.201
diff -u -d -r1.200 -r1.201
--- routerlist.c	7 Dec 2004 08:51:10 -0000	1.200
+++ routerlist.c	31 Dec 2004 21:47:54 -0000	1.201
@@ -396,12 +396,6 @@
   return NULL;
 }
 
-/** How many seconds a router must be up before we'll use it for
- * reliability-critical node positions.
- */
-#define ROUTER_REQUIRED_MIN_UPTIME 3600 /* an hour */
-#define ROUTER_REQUIRED_MIN_BANDWIDTH 10000
-
 int
 router_is_unreliable_router(routerinfo_t *router, int need_uptime, int need_bw)
 {



More information about the tor-commits mailing list