server/cwzmq.py
changeset 8670 f02139297beb
parent 8614 52f576a7394c
child 8695 358d8bed9626
--- a/server/cwzmq.py	Mon Jan 21 18:01:25 2013 +0100
+++ b/server/cwzmq.py	Tue Jan 22 18:16:20 2013 +0100
@@ -31,6 +31,13 @@
 
 ctx = zmq.Context()
 
+def cwproto_to_zmqaddr(address):
+    """ converts a cw-zmq address (like zmqpickle-tcp://<ip>:<port>)
+    into a proper zmq address (tcp://<ip>:<port>)
+    """
+    assert address.startswith('zmqpickle-'), 'bad protocol string %s' % address
+    return address.split('-', 1)[1] # chop the `zmqpickle-` prefix
+
 class ZMQComm(object):
     """
     A simple ZMQ-based notification bus.
@@ -140,7 +147,7 @@
         self.events = []
 
     def connect(self, address):
-        self.address = address
+        self.address = cwproto_to_zmqaddr(address)
 
     def run(self):
         """enter the service loop"""