Show More
@@ -570,35 +570,34 b' class unixforkingservice(object):' | |||
|
570 | 570 | |
|
571 | 571 | def _acceptnewconnection(self, sock, selector): |
|
572 | 572 | h = self._servicehandler |
|
573 |
|
|
|
573 | try: | |
|
574 | conn, _addr = sock.accept() | |
|
575 | except socket.error as inst: | |
|
576 | if inst.args[0] == errno.EINTR: | |
|
577 | return | |
|
578 | raise | |
|
579 | ||
|
580 | pid = os.fork() | |
|
581 | if pid: | |
|
574 | 582 | try: |
|
575 | conn, _addr = sock.accept() | |
|
576 | except socket.error as inst: | |
|
577 | if inst.args[0] == errno.EINTR: | |
|
578 |
|
|
|
579 |
|
|
|
580 | ||
|
581 | pid = os.fork() | |
|
582 |
|
|
|
583 | self.ui.log(b'cmdserver', b'forked worker process (pid=%d)\n', | |
|
584 | pid) | |
|
585 | self._workerpids.add(pid) | |
|
586 | h.newconnection() | |
|
587 | finally: | |
|
588 | conn.close() # release handle in parent process | |
|
589 | else: | |
|
590 | try: | |
|
591 | selector.close() | |
|
592 | sock.close() | |
|
593 | self._runworker(conn) | |
|
594 | conn.close() | |
|
595 | os._exit(0) | |
|
596 | except: # never return, hence no re-raises | |
|
583 | 597 | try: |
|
584 |
self.ui. |
|
|
585 | b'forked worker process (pid=%d)\n', pid) | |
|
586 | self._workerpids.add(pid) | |
|
587 | h.newconnection() | |
|
598 | self.ui.traceback(force=True) | |
|
588 | 599 | finally: |
|
589 | conn.close() # release handle in parent process | |
|
590 | else: | |
|
591 | try: | |
|
592 | selector.close() | |
|
593 | sock.close() | |
|
594 | self._runworker(conn) | |
|
595 | conn.close() | |
|
596 | os._exit(0) | |
|
597 | except: # never return, hence no re-raises | |
|
598 | try: | |
|
599 | self.ui.traceback(force=True) | |
|
600 | finally: | |
|
601 | os._exit(255) | |
|
600 | os._exit(255) | |
|
602 | 601 | |
|
603 | 602 | def _sigchldhandler(self, signal, frame): |
|
604 | 603 | self._reapworkers(os.WNOHANG) |
General Comments 0
You need to be logged in to leave comments.
Login now