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

[or-cvs] r17941: {torctl} Woops. Needed to take the min of bandwidthrate and bandwidth (torctl/trunk/python/TorCtl)



Author: mikeperry
Date: 2009-01-05 19:46:21 -0500 (Mon, 05 Jan 2009)
New Revision: 17941

Modified:
   torctl/trunk/python/TorCtl/TorCtl.py
Log:

Woops. Needed to take the min of bandwidthrate and
bandwidthcapacity. We were just using capacity.



Modified: torctl/trunk/python/TorCtl/TorCtl.py
===================================================================
--- torctl/trunk/python/TorCtl/TorCtl.py	2009-01-06 00:17:11 UTC (rev 17940)
+++ torctl/trunk/python/TorCtl/TorCtl.py	2009-01-06 00:46:21 UTC (rev 17941)
@@ -278,7 +278,7 @@
       pl = re.search(r"^platform Tor (\S+).*on (\S+)", line)
       ac = re.search(r"^accept (\S+):([^-]+)(?:-(\d+))?", line)
       rj = re.search(r"^reject (\S+):([^-]+)(?:-(\d+))?", line)
-      bw = re.search(r"^bandwidth \d+ \d+ (\d+)", line)
+      bw = re.search(r"^bandwidth (\d+) \d+ (\d+)", line)
       up = re.search(r"^uptime (\d+)", line)
       if re.search(r"^opt hibernating 1", line):
         #dead = 1 # XXX: Technically this may be stale..
@@ -289,7 +289,7 @@
       elif rj:
         exitpolicy.append(ExitPolicyLine(False, *rj.groups()))
       elif bw:
-        bw_observed = int(bw.group(1))
+        bw_observed = min(map(int, bw.groups()))
       elif pl:
         version, os = pl.groups()
       elif up: