changeset 33543:3ef3bf704e47

commandserver: do not handle EINTR for selector.select selectors2 library handles EINTR transparently so we don't need to handle select.error ourselves.
author Jun Wu <quark@fb.com>
date Sun, 16 Jul 2017 11:17:00 -0700
parents b11e8c67fb0f
children 4c4e95cae33a
files mercurial/commandserver.py
diffstat 1 files changed, 7 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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