Show More
@@ -477,11 +477,23 b' class unixforkingservice(object):' | |||||
477 | self._cleanup() |
|
477 | self._cleanup() | |
478 |
|
478 | |||
479 | def _mainloop(self): |
|
479 | def _mainloop(self): | |
|
480 | exiting = False | |||
480 | h = self._servicehandler |
|
481 | h = self._servicehandler | |
481 |
while |
|
482 | while True: | |
|
483 | if not exiting and h.shouldexit(): | |||
|
484 | # clients can no longer connect() to the domain socket, so | |||
|
485 | # we stop queuing new requests. | |||
|
486 | # for requests that are queued (connect()-ed, but haven't been | |||
|
487 | # accept()-ed), handle them before exit. otherwise, clients | |||
|
488 | # waiting for recv() will receive ECONNRESET. | |||
|
489 | self._unlinksocket() | |||
|
490 | exiting = True | |||
482 | try: |
|
491 | try: | |
483 | ready = select.select([self._sock], [], [], h.pollinterval)[0] |
|
492 | ready = select.select([self._sock], [], [], h.pollinterval)[0] | |
484 | if not ready: |
|
493 | if not ready: | |
|
494 | # only exit if we completed all queued requests | |||
|
495 | if exiting: | |||
|
496 | break | |||
485 | continue |
|
497 | continue | |
486 | conn, _addr = self._sock.accept() |
|
498 | conn, _addr = self._sock.accept() | |
487 | except (select.error, socket.error) as inst: |
|
499 | except (select.error, socket.error) as inst: |
General Comments 0
You need to be logged in to leave comments.
Login now