electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit c097b9a5303bdaf90a5c4d04ce80534257c5b278
parent 06cc8986520f9201512f2ad33cffa7b7b68ae311
Author: ThomasV <thomasv@gitorious>
Date:   Wed,  2 Oct 2013 03:24:14 +0200

delete only if cert is new

Diffstat:
Mlib/interface.py | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/interface.py b/lib/interface.py @@ -255,6 +255,7 @@ class Interface(threading.Thread): cert_path = os.path.join( self.config.get('path'), 'certs', self.host) if not os.path.exists(cert_path): + is_new = True # get server certificate. # Do not use ssl.get_server_certificate because it does not work with proxy s = socket.socket( socket.AF_INET, socket.SOCK_STREAM ) @@ -284,6 +285,8 @@ class Interface(threading.Thread): with open(cert_path,"w") as f: print_error("saving certificate for",self.host) f.write(cert) + else: + is_new = False s = socket.socket( socket.AF_INET, socket.SOCK_STREAM ) @@ -305,8 +308,9 @@ class Interface(threading.Thread): do_handshake_on_connect=True) except ssl.SSLError, e: print_error("SSL error:", self.host, e) - if e.errno == 1: - # delete the certificate so we will download a new one + + # delete the certificate so we will download a new one + if is_new and e.errno == 1: os.unlink(cert_path) return except: