##// END OF EJS Templates
Run code only when monitoring is enabled...
Jan Schulz -
Show More
@@ -178,15 +178,16 b' class EngineFactory(RegistrationFactory):'
178 hb_ping = maybe_tunnel(url('hb_ping'))
178 hb_ping = maybe_tunnel(url('hb_ping'))
179 hb_pong = maybe_tunnel(url('hb_pong'))
179 hb_pong = maybe_tunnel(url('hb_pong'))
180
180
181 # Add a monitor socket which will record the last time a ping was seen
182 mon = self.context.socket(zmq.SUB)
183 mport = mon.bind_to_random_port('tcp://127.0.0.1')
184 mon.setsockopt(zmq.SUBSCRIBE, b"")
185 self._hb_listener = zmqstream.ZMQStream(mon, self.loop)
186 self._hb_listener.on_recv(self._report_ping)
187
188 hb_monitor = None
181 hb_monitor = None
189 if self.max_heartbeat_misses > 0:
182 if self.max_heartbeat_misses > 0:
183 # Add a monitor socket which will record the last time a ping was seen
184 mon = self.context.socket(zmq.SUB)
185 mport = mon.bind_to_random_port('tcp://127.0.0.1')
186 mon.setsockopt(zmq.SUBSCRIBE, b"")
187 self._hb_listener = zmqstream.ZMQStream(mon, self.loop)
188 self._hb_listener.on_recv(self._report_ping)
189
190
190 hb_monitor = "tcp://127.0.0.1:%i"%mport
191 hb_monitor = "tcp://127.0.0.1:%i"%mport
191
192
192 heart = Heart(hb_ping, hb_pong, hb_monitor , heart_id=identity)
193 heart = Heart(hb_ping, hb_pong, hb_monitor , heart_id=identity)
General Comments 0
You need to be logged in to leave comments. Login now