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

[or-cvs] r9652: Add a lower-bound on MaxAdvertisedBandwidth. (in tor/trunk: . src/or)



Author: nickm
Date: 2007-02-25 14:43:23 -0500 (Sun, 25 Feb 2007)
New Revision: 9652

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/src/or/config.c
Log:
 r11944@catbus:  nickm | 2007-02-25 14:43:18 -0500
 Add a lower-bound on MaxAdvertisedBandwidth.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r11944] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2007-02-25 16:22:36 UTC (rev 9651)
+++ tor/trunk/ChangeLog	2007-02-25 19:43:23 UTC (rev 9652)
@@ -102,6 +102,7 @@
     - Always remove expired routers and networkstatus docs before checking
       whether we have enough information to build circuits. (Fixes
       bug 373.)
+    - Put a lower-bound on MaxAdvertisedBandwidth.
 
 
 Changes in version 0.1.2.7-alpha - 2007-02-06

Modified: tor/trunk/src/or/config.c
===================================================================
--- tor/trunk/src/or/config.c	2007-02-25 16:22:36 UTC (rev 9651)
+++ tor/trunk/src/or/config.c	2007-02-25 19:43:23 UTC (rev 9652)
@@ -2647,16 +2647,27 @@
     *msg = tor_strdup(r >= 0 ? buf : "internal error");
     return -1;
   }
-  if (server_mode(options) &&
-      options->BandwidthRate < ROUTER_REQUIRED_MIN_BANDWIDTH*2) {
-    r = tor_snprintf(buf, sizeof(buf),
-                     "BandwidthRate is set to %d bytes/second. "
-                     "For servers, it must be at least %d.",
-                     (int)options->BandwidthRate,
-                     ROUTER_REQUIRED_MIN_BANDWIDTH*2);
-    *msg = tor_strdup(r >= 0 ? buf : "internal error");
-    return -1;
+  if (server_mode(options)) {
+    if (options->BandwidthRate < ROUTER_REQUIRED_MIN_BANDWIDTH*2) {
+      r = tor_snprintf(buf, sizeof(buf),
+                       "BandwidthRate is set to %d bytes/second. "
+                       "For servers, it must be at least %d.",
+                       (int)options->BandwidthRate,
+                       ROUTER_REQUIRED_MIN_BANDWIDTH*2);
+      *msg = tor_strdup(r >= 0 ? buf : "internal error");
+      return -1;
+    } else if (options->MaxAdvertisedBandwidth <
+               ROUTER_REQUIRED_MIN_BANDWIDTH) {
+      r = tor_snprintf(buf, sizeof(buf),
+                       "MaxAdvertisedBandwidth is set to %d bytes/second. "
+                       "For servers, it must be at least %d.",
+                       (int)options->MaxAdvertisedBandwidth,
+                       ROUTER_REQUIRED_MIN_BANDWIDTH);
+      *msg = tor_strdup(r >= 0 ? buf : "internal error");
+      return -1;
+    }
   }
+
   if (options->BandwidthRate > options->BandwidthBurst)
     REJECT("BandwidthBurst must be at least equal to BandwidthRate.");