chgserver: refactor initialization of real/base addresses
authorYuya Nishihara <yuya@tcha.org>
Sun, 22 May 2016 14:06:37 +0900
changeset 29597 581c0c7cb258
parent 29596 71c197d82b7e
child 29598 a67398726747
chgserver: refactor initialization of real/base addresses Instead of overwriting self.address, calculate it from the address argument, which is the base address.
hgext/chgserver.py
--- a/hgext/chgserver.py	Sun May 22 14:05:34 2016 +0900
+++ b/hgext/chgserver.py	Sun May 22 14:06:37 2016 +0900
@@ -546,19 +546,19 @@
         self.lastactive = time.time()
 
     def bindsocket(self, sock, address):
-        self.address = address
-        self._inithashstate()
+        self._inithashstate(address)
         self._checkextensions()
         self._bind(sock)
         self._createsymlink()
 
-    def _inithashstate(self):
-        self.baseaddress = self.address
+    def _inithashstate(self, address):
+        self.baseaddress = address
         if self.ui.configbool('chgserver', 'skiphash', False):
             self.hashstate = None
+            self.address = address
             return
         self.hashstate = hashstate.fromui(self.ui)
-        self.address = _hashaddress(self.address, self.hashstate.confighash)
+        self.address = _hashaddress(address, self.hashstate.confighash)
 
     def _checkextensions(self):
         if not self.hashstate: