From 15584f0091b0fbea0c0379307cbc3c65591836c2 Mon Sep 17 00:00:00 2001 From: Jun Wu Date: Sun, 30 Apr 2017 11:21:05 -0700 Subject: [PATCH] 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. --- mercurial/chgserver.py | 5 +---- mercurial/commandserver.py | 7 ++----- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py index abab947041..7b482d6374 100644 --- a/mercurial/chgserver.py +++ b/mercurial/chgserver.py @@ -492,6 +492,7 @@ class chgunixservicehandler(object): self._checkextensions() self._bind(sock) self._createsymlink() + # no "listening at" message should be printed to simulate hg behavior def _inithashstate(self, address): self._baseaddress = address @@ -546,10 +547,6 @@ class chgunixservicehandler(object): # the client will start a new server on demand. util.tryunlink(self._realaddress) - def printbanner(self, address): - # no "listening at" message should be printed to simulate hg behavior - pass - def shouldexit(self): if not self._issocketowner(): self.ui.debug('%s is not owned, exiting.\n' % self._realaddress) diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py index 047cb2fdfa..bf81de653d 100644 --- a/mercurial/commandserver.py +++ b/mercurial/commandserver.py @@ -410,14 +410,12 @@ class unixservicehandler(object): def bindsocket(self, sock, address): util.bindunixsocket(sock, address) sock.listen(socket.SOMAXCONN) + self.ui.status(_('listening at %s\n') % address) + self.ui.flush() # avoid buffering of status message def unlinksocket(self, address): os.unlink(address) - def printbanner(self, address): - self.ui.status(_('listening at %s\n') % address) - self.ui.flush() # avoid buffering of status message - def shouldexit(self): """True if server should shut down; checked per pollinterval""" return False @@ -455,7 +453,6 @@ class unixforkingservice(object): self._servicehandler.bindsocket(self._sock, self.address) o = signal.signal(signal.SIGCHLD, self._sigchldhandler) self._oldsigchldhandler = o - self._servicehandler.printbanner(self.address) self._socketunlinked = False def _unlinksocket(self):