summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2015-07-20 19:18:03 -0400
committerKali Kaneko <kali@leap.se>2015-07-20 19:18:03 -0400
commit87339921eac261954e39901e3563851830309cc5 (patch)
treec89c1e819ca839503525c84aad0c4f69f9c7b7c7
parentf508d3629686d1ad4574e5a7ec67f8b3283f7c5f (diff)
[bug] do not add a port string to non-tcp addresses
this, together with the events server registration, was breaking the events signalling on the client whenever it used ipc:// sockets.
-rw-r--r--src/leap/common/events/zmq_components.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/leap/common/events/zmq_components.py b/src/leap/common/events/zmq_components.py
index 04f71e0..f99c754 100644
--- a/src/leap/common/events/zmq_components.py
+++ b/src/leap/common/events/zmq_components.py
@@ -128,16 +128,21 @@ class TxZmqComponent(object):
proto, addr, port = ADDRESS_RE.search(address).groups()
- if port is None or port is '0':
- params = proto, addr
- port = socket.bind_to_random_port("%s://%s" % params)
- # XXX this log doesn't appear
- logger.debug("Binded %s to %s://%s." % ((connClass,) + params))
+ if proto == "tcp":
+ if port is None or port is '0':
+ params = proto, addr
+ port = socket.bind_to_random_port("%s://%s" % params)
+ logger.debug("Binded %s to %s://%s." % ((connClass,) + params))
+ else:
+ params = proto, addr, int(port)
+ socket.bind("%s://%s:%d" % params)
+ logger.debug(
+ "Binded %s to %s://%s:%d." % ((connClass,) + params))
else:
- params = proto, addr, int(port)
- socket.bind("%s://%s:%d" % params)
- # XXX this log doesn't appear
- logger.debug("Binded %s to %s://%s:%d." % ((connClass,) + params))
+ params = proto, addr
+ socket.bind("%s://%s" % params)
+ logger.debug(
+ "Binded %s to %s://%s" % ((connClass,) + params))
self._connections.append(connection)
return connection, port