##// END OF EJS Templates
commandserver: remove redundant "if True" block
Yuya Nishihara -
r40913:9f00de4d default
parent child Browse files
Show More
@@ -570,35 +570,34 b' class unixforkingservice(object):'
570
570
571 def _acceptnewconnection(self, sock, selector):
571 def _acceptnewconnection(self, sock, selector):
572 h = self._servicehandler
572 h = self._servicehandler
573 if True:
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 try:
582 try:
575 conn, _addr = sock.accept()
583 self.ui.log(b'cmdserver', b'forked worker process (pid=%d)\n',
576 except socket.error as inst:
584 pid)
577 if inst.args[0] == errno.EINTR:
585 self._workerpids.add(pid)
578 return
586 h.newconnection()
579 raise
587 finally:
580
588 conn.close() # release handle in parent process
581 pid = os.fork()
589 else:
582 if pid:
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 try:
597 try:
584 self.ui.log(b'cmdserver',
598 self.ui.traceback(force=True)
585 b'forked worker process (pid=%d)\n', pid)
586 self._workerpids.add(pid)
587 h.newconnection()
588 finally:
599 finally:
589 conn.close() # release handle in parent process
600 os._exit(255)
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)
602
601
603 def _sigchldhandler(self, signal, frame):
602 def _sigchldhandler(self, signal, frame):
604 self._reapworkers(os.WNOHANG)
603 self._reapworkers(os.WNOHANG)
General Comments 0
You need to be logged in to leave comments. Login now