summaryrefslogtreecommitdiff
path: root/src/or/dirserv.c
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@fscked.org>2009-06-27 03:08:18 -0400
committerMike Perry <mikeperry-git@fscked.org>2009-08-06 14:47:08 -0700
commitca676c3924e58f5e07c749678d22315073dd0946 (patch)
tree24a2d28a59c1dfdf56580c214cfd2ee392a2e17d /src/or/dirserv.c
parentb074e61ad35efdf146da14c0b967da3aa24c2cdc (diff)
downloadtor-ca676c3924e58f5e07c749678d22315073dd0946.tar.gz
tor-ca676c3924e58f5e07c749678d22315073dd0946.zip
Display consensus bandwidth to the control port.
Also div vote and other bandwidth by 1000, not 1024.
Diffstat (limited to 'src/or/dirserv.c')
-rw-r--r--src/or/dirserv.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index d98d8c4ebf..1a47173686 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -1943,6 +1943,7 @@ routerstatus_format_entry(char *buf, size_t buf_len,
if (format != NS_V2) {
routerinfo_t* desc = router_get_by_digest(rs->identity_digest);
+ u_int32_t bw;
if (format != NS_CONTROL_PORT) {
/* Blow up more or less nicely if we didn't get anything or not the
@@ -1985,9 +1986,14 @@ routerstatus_format_entry(char *buf, size_t buf_len,
};
}
+ if (format == NS_CONTROL_PORT && rs->has_bandwidth) {
+ bw = rs->bandwidth;
+ } else {
+ tor_assert(desc);
+ bw = router_get_advertised_bandwidth_capped(desc) / 1000;
+ }
r = tor_snprintf(cp, buf_len - (cp-buf),
- "w Bandwidth=%d\n",
- router_get_advertised_bandwidth_capped(desc) / 1024);
+ "w Bandwidth=%d\n", bw);
if (r<0) {
log_warn(LD_BUG, "Not enough space in buffer.");