##// END OF EJS Templates
commandserver: prevent unlink socket twice...
Jun Wu -
r30887:a95fc01a default
parent child Browse files
Show More
@@ -447,6 +447,7 b' class unixforkingservice(object):'
447 self._sock = None
447 self._sock = None
448 self._oldsigchldhandler = None
448 self._oldsigchldhandler = None
449 self._workerpids = set() # updated by signal handler; do not iterate
449 self._workerpids = set() # updated by signal handler; do not iterate
450 self._socketunlinked = None
450
451
451 def init(self):
452 def init(self):
452 self._sock = socket.socket(socket.AF_UNIX)
453 self._sock = socket.socket(socket.AF_UNIX)
@@ -455,11 +456,17 b' class unixforkingservice(object):'
455 o = signal.signal(signal.SIGCHLD, self._sigchldhandler)
456 o = signal.signal(signal.SIGCHLD, self._sigchldhandler)
456 self._oldsigchldhandler = o
457 self._oldsigchldhandler = o
457 self._servicehandler.printbanner(self.address)
458 self._servicehandler.printbanner(self.address)
459 self._socketunlinked = False
460
461 def _unlinksocket(self):
462 if not self._socketunlinked:
463 self._servicehandler.unlinksocket(self.address)
464 self._socketunlinked = True
458
465
459 def _cleanup(self):
466 def _cleanup(self):
460 signal.signal(signal.SIGCHLD, self._oldsigchldhandler)
467 signal.signal(signal.SIGCHLD, self._oldsigchldhandler)
461 self._sock.close()
468 self._sock.close()
462 self._servicehandler.unlinksocket(self.address)
469 self._unlinksocket()
463 # don't kill child processes as they have active clients, just wait
470 # don't kill child processes as they have active clients, just wait
464 self._reapworkers(0)
471 self._reapworkers(0)
465
472
General Comments 0
You need to be logged in to leave comments. Login now