[PATCH V2] commandserver: do not handle EINTR for selector.select
Jun Wu
quark at fb.com
Sun Jul 16 18:23:40 UTC 2017
# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1500229020 25200
# Sun Jul 16 11:17:00 2017 -0700
# Node ID 3fce51f52763323f1ff2e233e44aa926c2095d05
# Parent d09de637cbc88ed2db989298115d0c0cb6cc6f27
# Available At https://bitbucket.org/quark-zju/hg-draft
# hg pull https://bitbucket.org/quark-zju/hg-draft -r 3fce51f52763
commandserver: do not handle EINTR for selector.select
selectors2 library handles EINTR transparently so we don't need to handle
select.error ourselves.
diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py
--- a/mercurial/commandserver.py
+++ b/mercurial/commandserver.py
@@ -12,5 +12,4 @@ import gc
import os
import random
-import select
import signal
import socket
@@ -489,13 +488,13 @@ class unixforkingservice(object):
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
More information about the Mercurial-devel
mailing list