##// END OF EJS Templates
Backport PR #4118: ZMQ heartbeat channel: catch EINTR exceptions and continue....
MinRK -
Show More
@@ -12,6 +12,7
12 # Imports
12 # Imports
13 #-----------------------------------------------------------------------------
13 #-----------------------------------------------------------------------------
14
14
15 import errno
15 import os
16 import os
16 import socket
17 import socket
17 from threading import Thread
18 from threading import Thread
@@ -52,5 +53,13 class Heartbeat(Thread):
52 self.socket = self.context.socket(zmq.REP)
53 self.socket = self.context.socket(zmq.REP)
53 c = ':' if self.transport == 'tcp' else '-'
54 c = ':' if self.transport == 'tcp' else '-'
54 self.socket.bind('%s://%s' % (self.transport, self.ip) + c + str(self.port))
55 self.socket.bind('%s://%s' % (self.transport, self.ip) + c + str(self.port))
56 while True:
57 try:
55 zmq.device(zmq.FORWARDER, self.socket, self.socket)
58 zmq.device(zmq.FORWARDER, self.socket, self.socket)
56
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