##// END OF EJS Templates
Backport PR #4118: ZMQ heartbeat channel: catch EINTR exceptions and continue....
MinRK -
Show More
@@ -12,6 +12,7 b''
12 12 # Imports
13 13 #-----------------------------------------------------------------------------
14 14
15 import errno
15 16 import os
16 17 import socket
17 18 from threading import Thread
@@ -52,5 +53,13 b' class Heartbeat(Thread):'
52 53 self.socket = self.context.socket(zmq.REP)
53 54 c = ':' if self.transport == 'tcp' else '-'
54 55 self.socket.bind('%s://%s' % (self.transport, self.ip) + c + str(self.port))
55 zmq.device(zmq.FORWARDER, self.socket, self.socket)
56
56 while True:
57 try:
58 zmq.device(zmq.FORWARDER, self.socket, self.socket)
59 except zmq.ZMQError as e:
60 if e.errno == errno.EINTR:
61 continue
62 else:
63 raise
64 else:
65 break
General Comments 0
You need to be logged in to leave comments. Login now