--- a/server/cwzmq.py Thu May 03 15:52:01 2012 +0200
+++ b/server/cwzmq.py Wed May 09 15:06:43 2012 +0200
@@ -117,7 +117,7 @@
self.repo = repository
self.socket = None
self.stream = None
- self.loop = None
+ self.loop = ioloop.IOLoop()
# event queue
self.events = []
@@ -129,7 +129,6 @@
"""enter the service loop"""
# start repository looping tasks
self.socket = ctx.socket(zmq.REP)
- self.loop = ioloop.IOLoop()
self.stream = zmq.eventloop.zmqstream.ZMQStream(self.socket, io_loop=self.loop)
self.stream.bind(self.address)
self.info('ZMQ server bound on: %s', self.address)
@@ -209,7 +208,7 @@
"""stop the server"""
self.info('Quitting ZMQ server')
try:
- self.loop.stop()
+ self.loop.add_callback(self.loop.stop)
self.stream.on_recv(None)
self.stream.close()
except Exception, e: