diff options
author | Benjamin Peterson <benjamin@python.org> | 2012-12-31 21:40:42 -0600 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2012-12-31 21:40:42 -0600 |
commit | 1f7df8f2070391f28391e3594580c07e11b6b32b (patch) | |
tree | ec03dfe4f71df3840232731145b8f6736fc6a314 /Lib/ssl.py | |
parent | b25d611f8d9140e83acbfffb6b0579939c88c033 (diff) | |
parent | 10e93a6d40502e100c68090730e0b3190df97854 (diff) | |
download | cpython-git-1f7df8f2070391f28391e3594580c07e11b6b32b.tar.gz |
merge heads
Diffstat (limited to 'Lib/ssl.py')
-rw-r--r-- | Lib/ssl.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/Lib/ssl.py b/Lib/ssl.py index 1951a620d9..88296358a0 100644 --- a/Lib/ssl.py +++ b/Lib/ssl.py @@ -313,17 +313,19 @@ class SSLSocket(socket): self.cert_reqs, self.ssl_version, self.ca_certs, self.ciphers) try: - socket.connect(self, addr) - if self.do_handshake_on_connect: - self.do_handshake() - except socket_error as e: if return_errno: - return e.errno + rc = socket.connect_ex(self, addr) else: - self._sslobj = None - raise e - self._connected = True - return 0 + rc = None + socket.connect(self, addr) + if not rc: + if self.do_handshake_on_connect: + self.do_handshake() + self._connected = True + return rc + except socket_error: + self._sslobj = None + raise def connect(self, addr): """Connects to remote ADDR, and then wraps the connection in |