##// END OF EJS Templates
commandserver: extract handler of new socket connection...
Yuya Nishihara -
r40912:dc990155 default
parent child Browse files
Show More
@@ -565,11 +565,17 b' class unixforkingservice(object):'
565 if exiting:
565 if exiting:
566 break
566 break
567 continue
567 continue
568 self._acceptnewconnection(self._sock, selector)
569 selector.close()
570
571 def _acceptnewconnection(self, sock, selector):
572 h = self._servicehandler
573 if True:
568 try:
574 try:
569 conn, _addr = self._sock.accept()
575 conn, _addr = sock.accept()
570 except socket.error as inst:
576 except socket.error as inst:
571 if inst.args[0] == errno.EINTR:
577 if inst.args[0] == errno.EINTR:
572 continue
578 return
573 raise
579 raise
574
580
575 pid = os.fork()
581 pid = os.fork()
@@ -584,7 +590,7 b' class unixforkingservice(object):'
584 else:
590 else:
585 try:
591 try:
586 selector.close()
592 selector.close()
587 self._sock.close()
593 sock.close()
588 self._runworker(conn)
594 self._runworker(conn)
589 conn.close()
595 conn.close()
590 os._exit(0)
596 os._exit(0)
@@ -593,7 +599,6 b' class unixforkingservice(object):'
593 self.ui.traceback(force=True)
599 self.ui.traceback(force=True)
594 finally:
600 finally:
595 os._exit(255)
601 os._exit(255)
596 selector.close()
597
602
598 def _sigchldhandler(self, signal, frame):
603 def _sigchldhandler(self, signal, frame):
599 self._reapworkers(os.WNOHANG)
604 self._reapworkers(os.WNOHANG)
General Comments 0
You need to be logged in to leave comments. Login now