gh-118950: Fix SSLProtocol.connection_lost not being called when OSError is thrown (#118960)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
This commit is contained in:
Javad Shafique 2024-10-24 19:41:16 +02:00 committed by GitHub
parent 41bd9d959c
commit 3f24bde0b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 53 additions and 1 deletions

View file

@ -101,7 +101,7 @@ class _SSLProtocolTransport(transports._FlowControlMixin,
return self._ssl_protocol._app_protocol
def is_closing(self):
return self._closed
return self._closed or self._ssl_protocol._is_transport_closing()
def close(self):
"""Close the transport.
@ -379,6 +379,9 @@ class SSLProtocol(protocols.BufferedProtocol):
self._app_transport_created = True
return self._app_transport
def _is_transport_closing(self):
return self._transport is not None and self._transport.is_closing()
def connection_made(self, transport):
"""Called when the low-level connection is made.