[tor-commits] [vidalia/master] Fix RouterDescriptor values when updated from a RouterStatus

chiiph at torproject.org chiiph at torproject.org
Mon Aug 13 21:39:49 UTC 2012


commit b3d4f7f00f0326207229aeb10a0d0961b32ed6a8
Author: Tomás Touceda <chiiph at torproject.org>
Date:   Mon Aug 13 18:35:41 2012 -0300

    Fix RouterDescriptor values when updated from a RouterStatus
---
 changes/bug6601                              |    2 ++
 src/torcontrol/RouterDescriptor.cpp          |    7 ++++---
 src/vidalia/network/RouterDescriptorView.cpp |    8 +++++---
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/changes/bug6601 b/changes/bug6601
new file mode 100644
index 0000000..cea8133
--- /dev/null
+++ b/changes/bug6601
@@ -0,0 +1,2 @@
+  o Fix RouterDescriptor's bandwidth and uptime values when defined from the
+    consensus. Fixes bug 6601.
diff --git a/src/torcontrol/RouterDescriptor.cpp b/src/torcontrol/RouterDescriptor.cpp
index 26051c1..2c2b147 100644
--- a/src/torcontrol/RouterDescriptor.cpp
+++ b/src/torcontrol/RouterDescriptor.cpp
@@ -106,7 +106,8 @@ RouterDescriptor::appendRouterStatusInfo(const RouterStatus &rs)
   _ip = rs.ipAddress();
   _orPort = rs.orPort();
   _dirPort = rs.dirPort();
-  _avgBandwidth = rs.bandwidth();
-  _burstBandwidth = rs.bandwidth();
-  _observedBandwidth = rs.bandwidth();
+  _avgBandwidth = rs.bandwidth() * 1024;
+  _burstBandwidth = rs.bandwidth() * 1024;
+  _observedBandwidth = rs.bandwidth() * 1024;
+  _published = rs.published();
 }
diff --git a/src/vidalia/network/RouterDescriptorView.cpp b/src/vidalia/network/RouterDescriptorView.cpp
index bb4b19d..8700612 100644
--- a/src/vidalia/network/RouterDescriptorView.cpp
+++ b/src/vidalia/network/RouterDescriptorView.cpp
@@ -106,7 +106,8 @@ RouterDescriptorView::display(QList<RouterDescriptor> rdlist)
 
     /* Add the IP address and router platform information */
     html.append(trow(tcol(b(tr("IP Address:"))) + tcol(rd.ip().toString())));
-    html.append(trow(tcol(b(tr("Platform:")))   + tcol(rd.platform())));
+    if (!rd.platform().isEmpty())
+      html.append(trow(tcol(b(tr("Platform:")))   + tcol(rd.platform())));
 
     /* If the router is online, then show the uptime and bandwidth stats. */
     if (!rd.offline()) {
@@ -121,8 +122,9 @@ RouterDescriptorView::display(QList<RouterDescriptor> rdlist)
     }
 
     /* Date the router was published */
-    html.append(trow(tcol(b(tr("Last Updated:")))  +
-                     tcol(string_format_datetime(rd.published()) + " GMT")));
+    if (!rd.published().isNull())
+      html.append(trow(tcol(b(tr("Last Updated:")))  +
+                       tcol(string_format_datetime(rd.published()) + " GMT")));
 
     html.append("</table>");
 



More information about the tor-commits mailing list