equal
deleted
inserted
replaced
14 import signal |
14 import signal |
15 import socket |
15 import socket |
16 import struct |
16 import struct |
17 import traceback |
17 import traceback |
18 |
18 |
|
19 try: |
|
20 import selectors |
|
21 selectors.BaseSelector |
|
22 except ImportError: |
|
23 from .thirdparty import selectors2 as selectors |
|
24 |
19 from .i18n import _ |
25 from .i18n import _ |
20 from .thirdparty import selectors2 |
|
21 from . import ( |
26 from . import ( |
22 encoding, |
27 encoding, |
23 error, |
28 error, |
24 pycompat, |
29 pycompat, |
25 util, |
30 util, |
474 self._cleanup() |
479 self._cleanup() |
475 |
480 |
476 def _mainloop(self): |
481 def _mainloop(self): |
477 exiting = False |
482 exiting = False |
478 h = self._servicehandler |
483 h = self._servicehandler |
479 selector = selectors2.DefaultSelector() |
484 selector = selectors.DefaultSelector() |
480 selector.register(self._sock, selectors2.EVENT_READ) |
485 selector.register(self._sock, selectors.EVENT_READ) |
481 while True: |
486 while True: |
482 if not exiting and h.shouldexit(): |
487 if not exiting and h.shouldexit(): |
483 # clients can no longer connect() to the domain socket, so |
488 # clients can no longer connect() to the domain socket, so |
484 # we stop queuing new requests. |
489 # we stop queuing new requests. |
485 # for requests that are queued (connect()-ed, but haven't been |
490 # for requests that are queued (connect()-ed, but haven't been |