commit c64f663c6f3215eb4e492cfe60bf7be46f50a1d0 Author: Damian Johnson atagar@torproject.org Date: Fri Apr 13 22:53:36 2012 -0700
Removing restriction that descriptor socks port is zero
The socks port of server descriptors is depricated and always zero, but this isn't necessarily true for archives. --- stem/descriptor/server_descriptor.py | 4 ++-- test/integ/descriptor/server_descriptor.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/stem/descriptor/server_descriptor.py b/stem/descriptor/server_descriptor.py index e91cab8..9b74e2b 100644 --- a/stem/descriptor/server_descriptor.py +++ b/stem/descriptor/server_descriptor.py @@ -355,8 +355,8 @@ class ServerDescriptorV3(stem.descriptor.Descriptor): raise ValueError("Router line entry isn't a valid IPv4 address: %s" % router_comp[1]) elif not stem.util.connection.is_valid_port(router_comp[2], allow_zero = True): raise ValueError("Router line's ORPort is invalid: %s" % router_comp[2]) - elif router_comp[3] != "0": - raise ValueError("Router line's SocksPort should be zero: %s" % router_comp[3]) + elif not stem.util.connection.is_valid_port(router_comp[3], allow_zero = True): + raise ValueError("Router line's SocksPort is invalid: %s" % router_comp[3]) elif not stem.util.connection.is_valid_port(router_comp[4], allow_zero = True): raise ValueError("Router line's DirPort is invalid: %s" % router_comp[4]) elif not (router_comp[2].isdigit() and router_comp[3].isdigit() and router_comp[4].isdigit()): diff --git a/test/integ/descriptor/server_descriptor.py b/test/integ/descriptor/server_descriptor.py index b7577da..24d9ee5 100644 --- a/test/integ/descriptor/server_descriptor.py +++ b/test/integ/descriptor/server_descriptor.py @@ -129,6 +129,7 @@ Qlx9HNCqCY877ztFRC624ja2ql6A2hBcuoYMbkHjcQ4= self.assertEquals(None, desc.read_history) self.assertEquals(None, desc.write_history) self.assertEquals(True, desc.eventdns) + self.assertEquals(0, desc.socks_port)
unrecognized_lines = desc.get_unrecognized_lines()
tor-commits@lists.torproject.org