sslutil: use a dict for hanging hg state off the wrapped socket
authorGregory Szorc <gregory.szorc@gmail.com>
Sun, 15 May 2016 11:25:07 -0700
changeset 29225 b115eed11780
parent 29224 7424f4294199
child 29226 33006bd6a1d7
sslutil: use a dict for hanging hg state off the wrapped socket I plan on introducing more state on the socket instance. Instead of using multiple variables, let's just use one to minimize risk of name collision.
mercurial/sslutil.py
--- a/mercurial/sslutil.py	Thu May 05 19:10:18 2016 -0700
+++ b/mercurial/sslutil.py	Sun May 15 11:25:07 2016 -0700
@@ -171,7 +171,9 @@
     if not sslsocket.cipher():
         raise error.Abort(_('ssl connection failed'))
 
-    sslsocket._hgcaloaded = caloaded
+    sslsocket._hgstate = {
+        'caloaded': caloaded,
+    }
 
     return sslsocket
 
@@ -341,7 +343,7 @@
                          (host, nicefingerprint))
             return
 
-        if not sock._hgcaloaded:
+        if not sock._hgstate['caloaded']:
             if strict:
                 raise error.Abort(_('%s certificate with fingerprint %s not '
                                     'verified') % (host, nicefingerprint),