[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [pytorctl/master] 8399 - Do not return 0 from get_unmeasured_bw



commit 68bc5de84dc90e1292c6aa19abd95f660b5e3277
Author: aagbsn <aagbsn@xxxxxxxx>
Date:   Tue Mar 5 19:56:29 2013 +0100

    8399 - Do not return 0 from get_unmeasured_bw
---
 TorCtl.py |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/TorCtl.py b/TorCtl.py
index 485a2d9..9bba58d 100755
--- a/TorCtl.py
+++ b/TorCtl.py
@@ -510,8 +510,9 @@ class Router:
 
   def get_unmeasured_bw(self):
     # if unmeasured, the ratio of self.bw/self.desc_bw should be 1.0
-    if self.unmeasured: return self.bw
-    else: return self.desc_bw
+    if self.unmeasured and self.bw > 0: return self.bw
+    elif self.desc_bw > 0: return self.desc_bw
+    else: return 1
    
 class Connection:
   """A Connection represents a connection to the Tor process via the 

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits