mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
When calling getpeername() in SSLSocket.__init__, only silence exceptions
caused by the "socket not connected" condition.
This commit is contained in:
parent
3bfa883207
commit
278d665c6a
1 changed files with 4 additions and 1 deletions
|
@ -78,6 +78,7 @@ from _ssl import \
|
|||
from socket import socket, _fileobject, _delegate_methods, error as socket_error
|
||||
from socket import getnameinfo as _getnameinfo
|
||||
import base64 # for DER-to-PEM translation
|
||||
import errno
|
||||
|
||||
class SSLSocket(socket):
|
||||
|
||||
|
@ -105,7 +106,9 @@ class SSLSocket(socket):
|
|||
# see if it's connected
|
||||
try:
|
||||
socket.getpeername(self)
|
||||
except socket_error:
|
||||
except socket_error, e:
|
||||
if e.errno != errno.ENOTCONN:
|
||||
raise
|
||||
# no, no connection yet
|
||||
self._sslobj = None
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue