diff options
author | Peter Palfrader <peter@palfrader.org> | 2008-08-14 12:37:00 +0000 |
---|---|---|
committer | Peter Palfrader <peter@palfrader.org> | 2008-08-14 12:37:00 +0000 |
commit | 24da63ea7b8757fd26fc58da922784e6f6ec5379 (patch) | |
tree | 7d38bad4e156bb029b375ce0a5feb2543d9a169e /src/or/routerlist.c | |
parent | 91f654f2ff187704e5bd1bf35a14b71ead38aa56 (diff) | |
download | tor-24da63ea7b8757fd26fc58da922784e6f6ec5379.tar.gz tor-24da63ea7b8757fd26fc58da922784e6f6ec5379.zip |
Add exit policy and bw to dirvotes - unfortunately also to v2 statuses
svn:r16536
Diffstat (limited to 'src/or/routerlist.c')
-rw-r--r-- | src/or/routerlist.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c index bce675ce0d..b504c5d608 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -1431,6 +1431,19 @@ router_get_advertised_bandwidth(routerinfo_t *router) * routers by bandwidth. */ #define DEFAULT_MAX_BELIEVABLE_BANDWIDTH 10000000 /* 10 MB/sec */ +/** Return the smaller of the router's configured BandwidthRate + * and its advertised capacity, capped by max-believe-bw. */ +uint32_t +router_get_advertised_bandwidth_capped(routerinfo_t *router) +{ + uint32_t result = router->bandwidthcapacity; + if (result > router->bandwidthrate) + result = router->bandwidthrate; + if (result > DEFAULT_MAX_BELIEVABLE_BANDWIDTH) + result = DEFAULT_MAX_BELIEVABLE_BANDWIDTH; + return result; +} + /** Eventually, the number we return will come from the directory * consensus, so clients can dynamically update to better numbers. * |