diff options
author | Nick Mathewson <nickm@torproject.org> | 2015-02-17 12:34:13 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-02-17 12:34:13 -0500 |
commit | 9bf6da1861f8cd67a40ea4f24a12d09413a8926f (patch) | |
tree | 6baeba401270f425c0df622207230678fcc74508 /src | |
parent | 1447324a6ca380a29fe84081d30eb7023d60cece (diff) | |
parent | 8b82f6261ea5c3fa154315f74be57710865e9a6b (diff) | |
download | tor-9bf6da1861f8cd67a40ea4f24a12d09413a8926f.tar.gz tor-9bf6da1861f8cd67a40ea4f24a12d09413a8926f.zip |
Merge remote-tracking branch 'public/feature_13822'
Diffstat (limited to 'src')
-rw-r--r-- | src/or/config.c | 29 | ||||
-rw-r--r-- | src/or/dirserv.c | 2 | ||||
-rw-r--r-- | src/or/or.h | 3 |
3 files changed, 20 insertions, 14 deletions
diff --git a/src/or/config.c b/src/or/config.c index 70ae2c02fc..92a1ce1f22 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -3190,29 +3190,34 @@ options_validate(or_options_t *old_options, or_options_t *options, options->RelayBandwidthRate = options->RelayBandwidthBurst; if (server_mode(options)) { - if (options->BandwidthRate < ROUTER_REQUIRED_MIN_BANDWIDTH) { + const unsigned required_min_bw = + public_server_mode(options) ? + RELAY_REQUIRED_MIN_BANDWIDTH : BRIDGE_REQUIRED_MIN_BANDWIDTH; + const char * const optbridge = + public_server_mode(options) ? "" : "bridge "; + if (options->BandwidthRate < required_min_bw) { tor_asprintf(msg, "BandwidthRate is set to %d bytes/second. " - "For servers, it must be at least %d.", - (int)options->BandwidthRate, - ROUTER_REQUIRED_MIN_BANDWIDTH); + "For %sservers, it must be at least %u.", + (int)options->BandwidthRate, optbridge, + required_min_bw); return -1; } else if (options->MaxAdvertisedBandwidth < - ROUTER_REQUIRED_MIN_BANDWIDTH/2) { + required_min_bw/2) { tor_asprintf(msg, "MaxAdvertisedBandwidth is set to %d bytes/second. " - "For servers, it must be at least %d.", - (int)options->MaxAdvertisedBandwidth, - ROUTER_REQUIRED_MIN_BANDWIDTH/2); + "For %sservers, it must be at least %u.", + (int)options->MaxAdvertisedBandwidth, optbridge, + required_min_bw/2); return -1; } if (options->RelayBandwidthRate && - options->RelayBandwidthRate < ROUTER_REQUIRED_MIN_BANDWIDTH) { + options->RelayBandwidthRate < required_min_bw) { tor_asprintf(msg, "RelayBandwidthRate is set to %d bytes/second. " - "For servers, it must be at least %d.", - (int)options->RelayBandwidthRate, - ROUTER_REQUIRED_MIN_BANDWIDTH); + "For %sservers, it must be at least %u.", + (int)options->RelayBandwidthRate, optbridge, + required_min_bw); return -1; } } diff --git a/src/or/dirserv.c b/src/or/dirserv.c index 384124df59..7bc91985a2 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 560f5ff5b7..d1961b5bb4 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -4941,7 +4941,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 |