[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
(FWD) [or-cvs] r10131: Added initial values for 'version' and 'os' in get_router(), (torflow/trunk/TorCtl)
- To: or-cvs@xxxxxxxxxxxxx
- Subject: (FWD) [or-cvs] r10131: Added initial values for 'version' and 'os' in get_router(), (torflow/trunk/TorCtl)
- From: Roger Dingledine <arma@xxxxxxx>
- Date: Mon, 7 May 2007 17:34:04 -0400
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Mon, 07 May 2007 17:34:17 -0400
- Reply-to: or-dev@xxxxxxxxxxxxx
- Sender: owner-or-cvs@xxxxxxxxxxxxx
- User-agent: Mutt/1.5.9i
[Forwarding since I screwed up and didn't add renner to the
whitelist. -RD]
----- Forwarded message from owner-or-cvs@xxxxxxxxxxxxx -----
To: or-cvs@xxxxxxxxxxxxx
From: renner@xxxxxxxx
Subject: [or-cvs] r10131: Added initial values for 'version' and 'os' in get_router(), (torflow/trunk/TorCtl)
Date: Mon, 7 May 2007 09:14:33 -0400 (EDT)
Author: renner
Date: 2007-05-07 09:13:58 -0400 (Mon, 07 May 2007)
New Revision: 10131
Modified:
torflow/trunk/TorCtl/TorCtl.py
Log:
Added initial values for 'version' and 'os' in get_router(), in case they don't get
provided by a descriptor. Also added a message (info) and modified the constructor
of RouterVersion to be able to handle version==None.
Modified: torflow/trunk/TorCtl/TorCtl.py
===================================================================
--- torflow/trunk/TorCtl/TorCtl.py 2007-05-07 10:08:40 UTC (rev 10130)
+++ torflow/trunk/TorCtl/TorCtl.py 2007-05-07 13:13:58 UTC (rev 10131)
@@ -182,9 +182,13 @@
class RouterVersion:
def __init__(self, version):
- v = re.search("^(\d+).(\d+).(\d+).(\d+)", version).groups()
- self.version = int(v[0])*0x1000000 + int(v[1])*0x10000 + int(v[2])*0x100 + int(v[3])
- self.ver_string = version
+ if version:
+ v = re.search("^(\d+).(\d+).(\d+).(\d+)", version).groups()
+ self.version = int(v[0])*0x1000000 + int(v[1])*0x10000 + int(v[2])*0x100 + int(v[3])
+ self.ver_string = version
+ else:
+ self.version = version
+ self.ver_string = "unknown"
def __lt__(self, other): return self.version < other.version
def __gt__(self, other): return self.version > other.version
@@ -522,6 +526,8 @@
exitpolicy = []
dead = not ("Running" in ns.flags)
bw_observed = 0
+ version = None
+ os = None
if router != ns.nickname:
plog("NOTICE", "Got different names " + ns.nickname + " vs " +
router + " for " + ns.idhex)
@@ -547,6 +553,8 @@
version, os = pl.groups()
if not bw_observed and not dead and ("Valid" in ns.flags):
plog("INFO", "No bandwidth for live router " + ns.nickname)
+ if not version or not os:
+ plog("INFO", "No version and/or OS for router " + ns.nickname)
return Router(ns.idhex, ns.nickname, bw_observed, dead, exitpolicy,
ns.flags, ip, version, os)
----- End forwarded message -----