Commit 2cf88eef authored by Julien Muchembled's avatar Julien Muchembled

Code cleanup

parent 6d759c9b
...@@ -42,8 +42,7 @@ def server(iface, max_clients, dh_path, pipe_fd, port, proto, encrypt, *args, ** ...@@ -42,8 +42,7 @@ def server(iface, max_clients, dh_path, pipe_fd, port, proto, encrypt, *args, **
def client(iface, address_list, encrypt, *args, **kw): def client(iface, address_list, encrypt, *args, **kw):
remote = ['--nobind', '--client'] remote = ['--nobind', '--client']
for ip, port, proto in address_list: for ip, port, proto in address_list:
remote += '--remote', ip, port, \ remote += '--remote', ip, port, proto
proto + '-client' if proto in ('tcp', 'tcp6') else proto
remote += args remote += args
return openvpn(iface, encrypt, *remote, **kw) return openvpn(iface, encrypt, *remote, **kw)
......
...@@ -281,7 +281,6 @@ class RegistryServer(object): ...@@ -281,7 +281,6 @@ class RegistryServer(object):
peers = deque(('%u/%u' % (int(self.prefix, 2), len(self.prefix)),)) peers = deque(('%u/%u' % (int(self.prefix, 2), len(self.prefix)),))
cookie = hex(random.randint(0, 1<<32))[2:] cookie = hex(random.randint(0, 1<<32))[2:]
graph = dict.fromkeys(peers) graph = dict.fromkeys(peers)
asked = 0
while True: while True:
r, w, _ = select.select([self.sock], r, w, _ = select.select([self.sock],
[self.sock] if peers else [], [], 1) [self.sock] if peers else [], [], 1)
......
...@@ -200,8 +200,9 @@ def dump_address(address): ...@@ -200,8 +200,9 @@ def dump_address(address):
def parse_address(address_list): def parse_address(address_list):
for address in address_list.split(';'): for address in address_list.split(';'):
try: try:
ip, port, proto = address.split(',') a = ip, port, proto = address.split(',')
yield ip, str(port), proto int(port)
yield a
except ValueError, e: except ValueError, e:
logging.warning("Failed to parse node address %r (%s)", logging.warning("Failed to parse node address %r (%s)",
address, e) address, e)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment