[bug] allow passing ':0' as port in events address
authordrebs <drebs@leap.se>
Fri, 26 Jun 2015 17:44:37 +0000 (14:44 -0300)
committerdrebs <drebs@leap.se>
Fri, 26 Jun 2015 17:44:37 +0000 (14:44 -0300)
src/leap/common/events/zmq_components.py

index 3b88862..04f71e0 100644 (file)
@@ -128,9 +128,9 @@ class TxZmqComponent(object):
 
         proto, addr, port = ADDRESS_RE.search(address).groups()
 
-        if port is None:
+        if port is None or port is '0':
             params = proto, addr
-            port = socket.bind("%s://%s" % params)
+            port = socket.bind_to_random_port("%s://%s" % params)
             # XXX this log doesn't appear
             logger.debug("Binded %s to %s://%s." % ((connClass,) + params))
         else: