commit 4beb83095351b46dcc26e0475341d6d96ce80fc5 Author: Nick Mathewson nickm@torproject.org Date: Sat Feb 7 08:30:40 2015 -0500
Split ROUTER_REQUIRED_MIN_BANDWIDTH into RELAY_ and BRIDGE_ variants
Also raise those minima from 20 to 75 and 50 respectively.
Closes ticket 13822. --- changes/feature13822 | 5 +++++ src/or/config.c | 17 +++++++++++------ src/or/dirserv.c | 2 +- src/or/or.h | 3 ++- 4 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/changes/feature13822 b/changes/feature13822 new file mode 100644 index 0000000..86ed0b8 --- /dev/null +++ b/changes/feature13822 @@ -0,0 +1,5 @@ + o Minor features: + - Use separate minimum bandwidth values for the configurations of + relays and bridges. Raise the minimum configured bandwidth for + bridges to 50 KiB/sec and for relays to 75 KiB/sec. (The old + values were 20 KiB/sec.) Closes ticket 13822. diff --git a/src/or/config.c b/src/or/config.c index de0baa4..144499e 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -3180,19 +3180,24 @@ options_validate(or_options_t *old_options, or_options_t *options, options->RelayBandwidthRate = options->RelayBandwidthBurst;
if (server_mode(options)) { + const unsigned ROUTER_REQUIRED_MIN_BANDWIDTH = // tolower XXXX + public_server_mode(options) ? + RELAY_REQUIRED_MIN_BANDWIDTH : BRIDGE_REQUIRED_MIN_BANDWIDTH; + const char * const optbridge = + public_server_mode(options) ? "" : "bridge "; if (options->BandwidthRate < ROUTER_REQUIRED_MIN_BANDWIDTH) { tor_asprintf(msg, "BandwidthRate is set to %d bytes/second. " - "For servers, it must be at least %d.", - (int)options->BandwidthRate, + "For %sservers, it must be at least %u.", + (int)options->BandwidthRate, optbridge, ROUTER_REQUIRED_MIN_BANDWIDTH); return -1; } else if (options->MaxAdvertisedBandwidth < ROUTER_REQUIRED_MIN_BANDWIDTH/2) { tor_asprintf(msg, "MaxAdvertisedBandwidth is set to %d bytes/second. " - "For servers, it must be at least %d.", - (int)options->MaxAdvertisedBandwidth, + "For %sservers, it must be at least %u.", + (int)options->MaxAdvertisedBandwidth, optbridge, ROUTER_REQUIRED_MIN_BANDWIDTH/2); return -1; } @@ -3200,8 +3205,8 @@ options_validate(or_options_t *old_options, or_options_t *options, options->RelayBandwidthRate < ROUTER_REQUIRED_MIN_BANDWIDTH) { tor_asprintf(msg, "RelayBandwidthRate is set to %d bytes/second. " - "For servers, it must be at least %d.", - (int)options->RelayBandwidthRate, + "For %sservers, it must be at least %u.", + (int)options->RelayBandwidthRate, optbridge, ROUTER_REQUIRED_MIN_BANDWIDTH); return -1; } diff --git a/src/or/dirserv.c b/src/or/dirserv.c index d906195..fe8196c 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -1427,7 +1427,7 @@ dirserv_compute_performance_thresholds(routerlist_t *rl, /* The 12.5th percentile bandwidth is fast. */ fast_bandwidth_kb = find_nth_uint32(bandwidths_kb, n_active, n_active/8); /* (Now bandwidths is sorted.) */ - if (fast_bandwidth_kb < ROUTER_REQUIRED_MIN_BANDWIDTH/(2 * 1000)) + if (fast_bandwidth_kb < RELAY_REQUIRED_MIN_BANDWIDTH/(2 * 1000)) fast_bandwidth_kb = bandwidths_kb[n_active/4]; guard_bandwidth_including_exits_kb = third_quartile_uint32(bandwidths_kb, n_active); diff --git a/src/or/or.h b/src/or/or.h index 520b7db..5cea06f 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -4937,7 +4937,8 @@ typedef struct dir_server_t { **/ } dir_server_t;
-#define ROUTER_REQUIRED_MIN_BANDWIDTH (20*1024) +#define RELAY_REQUIRED_MIN_BANDWIDTH (75*1024) +#define BRIDGE_REQUIRED_MIN_BANDWIDTH (50*1024)
#define ROUTER_MAX_DECLARED_BANDWIDTH INT32_MAX
tor-commits@lists.torproject.org