Make sure BaseException is re-raised in SSLProtocol
This commit is contained in:
parent
1dd213ee66
commit
f57cfc623a
@ -613,7 +613,8 @@ class SSLProtocol(protocols.Protocol):
|
|||||||
if data:
|
if data:
|
||||||
ssldata, offset = self._sslpipe.feed_appdata(data, offset)
|
ssldata, offset = self._sslpipe.feed_appdata(data, offset)
|
||||||
elif offset:
|
elif offset:
|
||||||
ssldata = self._sslpipe.do_handshake(self._on_handshake_complete)
|
ssldata = self._sslpipe.do_handshake(
|
||||||
|
self._on_handshake_complete)
|
||||||
offset = 1
|
offset = 1
|
||||||
else:
|
else:
|
||||||
ssldata = self._sslpipe.shutdown(self._finalize)
|
ssldata = self._sslpipe.shutdown(self._finalize)
|
||||||
@ -637,9 +638,13 @@ class SSLProtocol(protocols.Protocol):
|
|||||||
self._write_buffer_size -= len(data)
|
self._write_buffer_size -= len(data)
|
||||||
except BaseException as exc:
|
except BaseException as exc:
|
||||||
if self._in_handshake:
|
if self._in_handshake:
|
||||||
|
# BaseExceptions will be re-raised in _on_handshake_complete.
|
||||||
self._on_handshake_complete(exc)
|
self._on_handshake_complete(exc)
|
||||||
else:
|
else:
|
||||||
self._fatal_error(exc, 'Fatal error on SSL transport')
|
self._fatal_error(exc, 'Fatal error on SSL transport')
|
||||||
|
if not isinstance(exc, Exception):
|
||||||
|
# BaseException
|
||||||
|
raise
|
||||||
|
|
||||||
def _fatal_error(self, exc, message='Fatal error on transport'):
|
def _fatal_error(self, exc, message='Fatal error on transport'):
|
||||||
# Should be called from exception handler only.
|
# Should be called from exception handler only.
|
||||||
|
Loading…
Reference in New Issue
Block a user