commandserver: do not handle EINTR for selector.select
authorJun Wu <quark@fb.com>
Sun, 16 Jul 2017 11:17:00 -0700
changeset 33543 3ef3bf704e47
parent 33542 b11e8c67fb0f
child 33544 4c4e95cae33a
commandserver: do not handle EINTR for selector.select selectors2 library handles EINTR transparently so we don't need to handle select.error ourselves.
mercurial/commandserver.py
--- a/mercurial/commandserver.py	Sun Jul 16 02:33:14 2017 +0200
+++ b/mercurial/commandserver.py	Sun Jul 16 11:17:00 2017 -0700
@@ -11,7 +11,6 @@
 import gc
 import os
 import random
-import select
 import signal
 import socket
 import struct
@@ -488,15 +487,15 @@
                 # waiting for recv() will receive ECONNRESET.
                 self._unlinksocket()
                 exiting = True
+            ready = selector.select(timeout=h.pollinterval)
+            if not ready:
+                # only exit if we completed all queued requests
+                if exiting:
+                    break
+                continue
             try:
-                ready = selector.select(timeout=h.pollinterval)
-                if not ready:
-                    # only exit if we completed all queued requests
-                    if exiting:
-                        break
-                    continue
                 conn, _addr = self._sock.accept()
-            except (select.error, socket.error) as inst:
+            except socket.error as inst:
                 if inst.args[0] == errno.EINTR:
                     continue
                 raise