[tor-commits] [vidalia/master] Use minimum bandwidth

chiiph at torproject.org chiiph at torproject.org
Thu May 5 19:28:57 UTC 2011


commit 9adaff9833062acc773ab446d6becd3dc08bf8e6
Author: Tomas Touceda <chiiph at gentoo.org>
Date:   Sat Apr 30 17:14:18 2011 -0300

    Use minimum bandwidth
---
 src/vidalia/network/RouterDescriptorView.cpp |    5 ++++-
 src/vidalia/network/RouterListItem.cpp       |    4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/vidalia/network/RouterDescriptorView.cpp b/src/vidalia/network/RouterDescriptorView.cpp
index 63c3102..ab94889 100644
--- a/src/vidalia/network/RouterDescriptorView.cpp
+++ b/src/vidalia/network/RouterDescriptorView.cpp
@@ -110,8 +110,11 @@ RouterDescriptorView::display(QList<RouterDescriptor> rdlist)
 
     /* If the router is online, then show the uptime and bandwidth stats. */
     if (!rd.offline()) {
+      qint64 minBandwidth = (qint64)qMin(rd.observedBandwidth(), 
+                                qMin(rd.averageBandwidth(),
+                                     rd.burstBandwidth()));
       html.append(trow(tcol(b(tr("Bandwidth:")))  + 
-                       tcol(string_format_bandwidth(rd.observedBandwidth()))));
+                       tcol(string_format_bandwidth(minBandwidth))));
       html.append(trow(tcol(b(tr("Uptime:")))   + 
                        tcol(string_format_uptime(
                               adjustUptime(rd.uptime(), rd.published())))));
diff --git a/src/vidalia/network/RouterListItem.cpp b/src/vidalia/network/RouterListItem.cpp
index 904a3f7..f0bdcad 100644
--- a/src/vidalia/network/RouterListItem.cpp
+++ b/src/vidalia/network/RouterListItem.cpp
@@ -69,7 +69,9 @@ RouterListItem::update(const RouterDescriptor &rd)
     statusIcon = QIcon(IMG_NODE_SLEEPING);
     setToolTip(STATUS_COLUMN, tr("Hibernating"));
   } else {
-    _statusValue = (qint64)_rd->observedBandwidth();
+    _statusValue = (qint64)qMin(_rd->observedBandwidth(), 
+                                qMin(_rd->averageBandwidth(),
+                                     _rd->burstBandwidth()));
     if (_statusValue >= 400*1024) {
       statusIcon = QIcon(IMG_NODE_HIGH_BW);
     } else if (_statusValue >= 60*1024) {





More information about the tor-commits mailing list