]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Display consensus bandwidth to the control port.
authorMike Perry <mikeperry-git@fscked.org>
Sat, 27 Jun 2009 07:08:18 +0000 (03:08 -0400)
committerMike Perry <mikeperry-git@fscked.org>
Thu, 6 Aug 2009 21:47:08 +0000 (14:47 -0700)
Also div vote and other bandwidth by 1000, not 1024.

src/or/dirserv.c

index d98d8c4ebf135f223f5d4dfd3da4e9c262811c49..1a471736867b893e76e5ae786f5b5a388f994398 100644 (file)
@@ -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.");