##// END OF EJS Templates
chgserver: reorder functions in chgunixservicehandler...
Yuya Nishihara -
r29596:71c197d8 default
parent child Browse files
Show More
@@ -569,29 +569,6 b' class chgunixservicehandler(object):'
569 # set mtimehash to an illegal hash value to invalidate the server.
569 # set mtimehash to an illegal hash value to invalidate the server.
570 self.hashstate.mtimehash = ''
570 self.hashstate.mtimehash = ''
571
571
572 def _createsymlink(self):
573 if self.baseaddress == self.address:
574 return
575 tempaddress = _tempaddress(self.baseaddress)
576 os.symlink(os.path.basename(self.address), tempaddress)
577 util.rename(tempaddress, self.baseaddress)
578
579 def printbanner(self, address):
580 # no "listening at" message should be printed to simulate hg behavior
581 pass
582
583 def shouldexit(self):
584 if not self.issocketowner():
585 self.ui.debug('%s is not owned, exiting.\n' % self.address)
586 return True
587 if time.time() - self.lastactive > self.idletimeout:
588 self.ui.debug('being idle too long. exiting.\n')
589 return True
590 return False
591
592 def newconnection(self):
593 self.lastactive = time.time()
594
595 def _bind(self, sock):
572 def _bind(self, sock):
596 # use a unique temp address so we can stat the file and do ownership
573 # use a unique temp address so we can stat the file and do ownership
597 # check later
574 # check later
@@ -602,6 +579,13 b' class chgunixservicehandler(object):'
602 # old server will detect ownership change and exit.
579 # old server will detect ownership change and exit.
603 util.rename(tempaddress, self.address)
580 util.rename(tempaddress, self.address)
604
581
582 def _createsymlink(self):
583 if self.baseaddress == self.address:
584 return
585 tempaddress = _tempaddress(self.baseaddress)
586 os.symlink(os.path.basename(self.address), tempaddress)
587 util.rename(tempaddress, self.baseaddress)
588
605 def issocketowner(self):
589 def issocketowner(self):
606 try:
590 try:
607 stat = os.stat(self.address)
591 stat = os.stat(self.address)
@@ -623,6 +607,22 b' class chgunixservicehandler(object):'
623 if exc.errno != errno.ENOENT:
607 if exc.errno != errno.ENOENT:
624 raise
608 raise
625
609
610 def printbanner(self, address):
611 # no "listening at" message should be printed to simulate hg behavior
612 pass
613
614 def shouldexit(self):
615 if not self.issocketowner():
616 self.ui.debug('%s is not owned, exiting.\n' % self.address)
617 return True
618 if time.time() - self.lastactive > self.idletimeout:
619 self.ui.debug('being idle too long. exiting.\n')
620 return True
621 return False
622
623 def newconnection(self):
624 self.lastactive = time.time()
625
626 def createcmdserver(self, repo, conn, fin, fout):
626 def createcmdserver(self, repo, conn, fin, fout):
627 return chgcmdserver(self.ui, repo, fin, fout, conn,
627 return chgcmdserver(self.ui, repo, fin, fout, conn,
628 self.hashstate, self.baseaddress)
628 self.hashstate, self.baseaddress)
General Comments 0
You need to be logged in to leave comments. Login now