summaryrefslogtreecommitdiff
path: root/src/or/router.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-02-28 16:56:07 +0000
committerNick Mathewson <nickm@torproject.org>2007-02-28 16:56:07 +0000
commitdae5fc798271db3b993be1b38cfada73e05dab68 (patch)
tree088205a2ec3a8f904b9ed0c10b87c51566481e9c /src/or/router.c
parentebf1862382d25f155228325a85a3c11ab48b7b86 (diff)
downloadtor-dae5fc798271db3b993be1b38cfada73e05dab68.tar.gz
tor-dae5fc798271db3b993be1b38cfada73e05dab68.zip
r11981@catbus: nickm | 2007-02-28 11:55:27 -0500
Clamp declarable bandwidth at INT32_MAX, not INT_MAX. svn:r9677
Diffstat (limited to 'src/or/router.c')
-rw-r--r--src/or/router.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/or/router.c b/src/or/router.c
index 881fc9301e..24ec0e90c3 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -877,8 +877,13 @@ router_rebuild_descriptor(int force)
ri->bandwidthburst = (int)options->BandwidthBurst;
ri->bandwidthcapacity = hibernating ? 0 : rep_hist_bandwidth_assess();
- if (options->BandwidthRate > options->MaxAdvertisedBandwidth)
- ri->bandwidthrate = (int)options->MaxAdvertisedBandwidth;
+ if (options->BandwidthRate > options->MaxAdvertisedBandwidth) {
+ if (options->MaxAdvertisedBandwidth > ROUTER_MAX_DECLARED_BANDWIDTH) {
+ ri->bandwidthrate = ROUTER_MAX_DECLARED_BANDWIDTH;
+ } else {
+ ri->bandwidthrate = (int)options->MaxAdvertisedBandwidth;
+ }
+ }
policies_parse_exit_policy(options->ExitPolicy, &ri->exit_policy,
options->ExitPolicyRejectPrivate);