Show More
@@ -17,6 +17,7 b' TODO' | |||
|
17 | 17 | |
|
18 | 18 | # Standard library imports. |
|
19 | 19 | import atexit |
|
20 | import errno | |
|
20 | 21 | from Queue import Queue, Empty |
|
21 | 22 | from subprocess import Popen |
|
22 | 23 | import signal |
@@ -108,6 +109,19 b' class ZmqSocketChannel(Thread):' | |||
|
108 | 109 | raise InvalidPortNumber(message) |
|
109 | 110 | self._address = address |
|
110 | 111 | |
|
112 | def _run_loop(self): | |
|
113 | """Run my loop, ignoring EINTR events in the poller""" | |
|
114 | while True: | |
|
115 | try: | |
|
116 | self.ioloop.start() | |
|
117 | except zmq.ZMQError as e: | |
|
118 | if e.errno == errno.EINTR: | |
|
119 | continue | |
|
120 | else: | |
|
121 | raise | |
|
122 | else: | |
|
123 | break | |
|
124 | ||
|
111 | 125 | def stop(self): |
|
112 | 126 | """Stop the channel's activity. |
|
113 | 127 | |
@@ -178,7 +192,7 b' class XReqSocketChannel(ZmqSocketChannel):' | |||
|
178 | 192 | self.iostate = POLLERR|POLLIN |
|
179 | 193 | self.ioloop.add_handler(self.socket, self._handle_events, |
|
180 | 194 | self.iostate) |
|
181 |
self. |
|
|
195 | self._run_loop() | |
|
182 | 196 | |
|
183 | 197 | def stop(self): |
|
184 | 198 | self.ioloop.stop() |
@@ -385,7 +399,7 b' class SubSocketChannel(ZmqSocketChannel):' | |||
|
385 | 399 | self.iostate = POLLIN|POLLERR |
|
386 | 400 | self.ioloop.add_handler(self.socket, self._handle_events, |
|
387 | 401 | self.iostate) |
|
388 |
self. |
|
|
402 | self._run_loop() | |
|
389 | 403 | |
|
390 | 404 | def stop(self): |
|
391 | 405 | self.ioloop.stop() |
@@ -473,7 +487,7 b' class RepSocketChannel(ZmqSocketChannel):' | |||
|
473 | 487 | self.iostate = POLLERR|POLLIN |
|
474 | 488 | self.ioloop.add_handler(self.socket, self._handle_events, |
|
475 | 489 | self.iostate) |
|
476 |
self. |
|
|
490 | self._run_loop() | |
|
477 | 491 | |
|
478 | 492 | def stop(self): |
|
479 | 493 | self.ioloop.stop() |
@@ -591,7 +605,16 b' class HBSocketChannel(ZmqSocketChannel):' | |||
|
591 | 605 | # returns quickly. Note: poll timeout is in |
|
592 | 606 | # milliseconds. |
|
593 | 607 | if until_dead > 0.0: |
|
608 | while True: | |
|
609 | try: | |
|
594 | 610 | self.poller.poll(1000 * until_dead) |
|
611 | except zmq.ZMQError as e: | |
|
612 | if e.errno == errno.EINTR: | |
|
613 | continue | |
|
614 | else: | |
|
615 | raise | |
|
616 | else: | |
|
617 | break | |
|
595 | 618 | |
|
596 | 619 | since_last_heartbeat = time.time()-request_time |
|
597 | 620 | if since_last_heartbeat > self.time_to_dead: |
General Comments 0
You need to be logged in to leave comments.
Login now