##// END OF EJS Templates
set linger on every socket I can find...
MinRK -
Show More
@@ -209,6 +209,7 b' class ShellChannel(ZMQSocketChannel):'
209 def run(self):
209 def run(self):
210 """The thread's main activity. Call start() instead."""
210 """The thread's main activity. Call start() instead."""
211 self.socket = self.context.socket(zmq.DEALER)
211 self.socket = self.context.socket(zmq.DEALER)
212 self.socket.linger = 1000
212 self.socket.setsockopt(zmq.IDENTITY, self.session.bsession)
213 self.socket.setsockopt(zmq.IDENTITY, self.session.bsession)
213 self.socket.connect(self.address)
214 self.socket.connect(self.address)
214 self.stream = zmqstream.ZMQStream(self.socket, self.ioloop)
215 self.stream = zmqstream.ZMQStream(self.socket, self.ioloop)
@@ -408,6 +409,7 b' class IOPubChannel(ZMQSocketChannel):'
408 def run(self):
409 def run(self):
409 """The thread's main activity. Call start() instead."""
410 """The thread's main activity. Call start() instead."""
410 self.socket = self.context.socket(zmq.SUB)
411 self.socket = self.context.socket(zmq.SUB)
412 self.socket.linger = 1000
411 self.socket.setsockopt(zmq.SUBSCRIBE,b'')
413 self.socket.setsockopt(zmq.SUBSCRIBE,b'')
412 self.socket.setsockopt(zmq.IDENTITY, self.session.bsession)
414 self.socket.setsockopt(zmq.IDENTITY, self.session.bsession)
413 self.socket.connect(self.address)
415 self.socket.connect(self.address)
@@ -468,6 +470,7 b' class StdInChannel(ZMQSocketChannel):'
468 def run(self):
470 def run(self):
469 """The thread's main activity. Call start() instead."""
471 """The thread's main activity. Call start() instead."""
470 self.socket = self.context.socket(zmq.DEALER)
472 self.socket = self.context.socket(zmq.DEALER)
473 self.socket.linger = 1000
471 self.socket.setsockopt(zmq.IDENTITY, self.session.bsession)
474 self.socket.setsockopt(zmq.IDENTITY, self.session.bsession)
472 self.socket.connect(self.address)
475 self.socket.connect(self.address)
473 self.stream = zmqstream.ZMQStream(self.socket, self.ioloop)
476 self.stream = zmqstream.ZMQStream(self.socket, self.ioloop)
@@ -518,7 +521,7 b' class HBChannel(ZMQSocketChannel):'
518 self.poller.unregister(self.socket)
521 self.poller.unregister(self.socket)
519 self.socket.close()
522 self.socket.close()
520 self.socket = self.context.socket(zmq.REQ)
523 self.socket = self.context.socket(zmq.REQ)
521 self.socket.setsockopt(zmq.LINGER, 0)
524 self.socket.linger = 1000
522 self.socket.connect(self.address)
525 self.socket.connect(self.address)
523
526
524 self.poller.register(self.socket, zmq.POLLIN)
527 self.poller.register(self.socket, zmq.POLLIN)
@@ -53,6 +53,7 b' class Heartbeat(Thread):'
53
53
54 def run(self):
54 def run(self):
55 self.socket = self.context.socket(zmq.REP)
55 self.socket = self.context.socket(zmq.REP)
56 self.socket.linger = 1000
56 c = ':' if self.transport == 'tcp' else '-'
57 c = ':' if self.transport == 'tcp' else '-'
57 self.socket.bind('%s://%s' % (self.transport, self.ip) + c + str(self.port))
58 self.socket.bind('%s://%s' % (self.transport, self.ip) + c + str(self.port))
58 while True:
59 while True:
@@ -298,18 +298,22 b' class IPKernelApp(BaseIPythonApplication, InteractiveShellApp):'
298 # atexit.register(context.term)
298 # atexit.register(context.term)
299
299
300 self.shell_socket = context.socket(zmq.ROUTER)
300 self.shell_socket = context.socket(zmq.ROUTER)
301 self.shell_socket.linger = 1000
301 self.shell_port = self._bind_socket(self.shell_socket, self.shell_port)
302 self.shell_port = self._bind_socket(self.shell_socket, self.shell_port)
302 self.log.debug("shell ROUTER Channel on port: %i" % self.shell_port)
303 self.log.debug("shell ROUTER Channel on port: %i" % self.shell_port)
303
304
304 self.iopub_socket = context.socket(zmq.PUB)
305 self.iopub_socket = context.socket(zmq.PUB)
306 self.iopub_socket.linger = 1000
305 self.iopub_port = self._bind_socket(self.iopub_socket, self.iopub_port)
307 self.iopub_port = self._bind_socket(self.iopub_socket, self.iopub_port)
306 self.log.debug("iopub PUB Channel on port: %i" % self.iopub_port)
308 self.log.debug("iopub PUB Channel on port: %i" % self.iopub_port)
307
309
308 self.stdin_socket = context.socket(zmq.ROUTER)
310 self.stdin_socket = context.socket(zmq.ROUTER)
311 self.stdin_socket.linger = 1000
309 self.stdin_port = self._bind_socket(self.stdin_socket, self.stdin_port)
312 self.stdin_port = self._bind_socket(self.stdin_socket, self.stdin_port)
310 self.log.debug("stdin ROUTER Channel on port: %i" % self.stdin_port)
313 self.log.debug("stdin ROUTER Channel on port: %i" % self.stdin_port)
311
314
312 self.control_socket = context.socket(zmq.ROUTER)
315 self.control_socket = context.socket(zmq.ROUTER)
316 self.control_socket.linger = 1000
313 self.control_port = self._bind_socket(self.control_socket, self.control_port)
317 self.control_port = self._bind_socket(self.control_socket, self.control_port)
314 self.log.debug("control ROUTER Channel on port: %i" % self.control_port)
318 self.log.debug("control ROUTER Channel on port: %i" % self.control_port)
315
319
General Comments 0
You need to be logged in to leave comments. Login now