comparison mercurial/chgserver.py @ 32277:1ada3d18e7fb

commandserver: move printbanner logic to bindsocket bindsocket now handles listen automatically. "printbanner" seems to be just a part of "bindsocket". This simplifies the interface a bit.
author Jun Wu <quark@fb.com>
date Sun, 30 Apr 2017 11:21:05 -0700
parents c8b9943c07eb
children 6096d27dc119
comparison
equal deleted inserted replaced
32276:c8b9943c07eb 32277:1ada3d18e7fb
490 def bindsocket(self, sock, address): 490 def bindsocket(self, sock, address):
491 self._inithashstate(address) 491 self._inithashstate(address)
492 self._checkextensions() 492 self._checkextensions()
493 self._bind(sock) 493 self._bind(sock)
494 self._createsymlink() 494 self._createsymlink()
495 # no "listening at" message should be printed to simulate hg behavior
495 496
496 def _inithashstate(self, address): 497 def _inithashstate(self, address):
497 self._baseaddress = address 498 self._baseaddress = address
498 if self.ui.configbool('chgserver', 'skiphash', False): 499 if self.ui.configbool('chgserver', 'skiphash', False):
499 self._hashstate = None 500 self._hashstate = None
544 # remove another server's socket file. but that's okay 545 # remove another server's socket file. but that's okay
545 # since that server will detect and exit automatically and 546 # since that server will detect and exit automatically and
546 # the client will start a new server on demand. 547 # the client will start a new server on demand.
547 util.tryunlink(self._realaddress) 548 util.tryunlink(self._realaddress)
548 549
549 def printbanner(self, address):
550 # no "listening at" message should be printed to simulate hg behavior
551 pass
552
553 def shouldexit(self): 550 def shouldexit(self):
554 if not self._issocketowner(): 551 if not self._issocketowner():
555 self.ui.debug('%s is not owned, exiting.\n' % self._realaddress) 552 self.ui.debug('%s is not owned, exiting.\n' % self._realaddress)
556 return True 553 return True
557 if time.time() - self._lastactive > self._idletimeout: 554 if time.time() - self._lastactive > self._idletimeout: