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

aagbsn at torproject.org aagbsn at torproject.org
Thu Mar 14 11:15:22 UTC 2013


commit 68bc5de84dc90e1292c6aa19abd95f660b5e3277
Author: aagbsn <aagbsn at extc.org>
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 



More information about the tor-commits mailing list