Skip to content

Commit

Permalink
pythongh-118950: Let _SSLProtocolTransport.is_closing reflect SSLProt…
Browse files Browse the repository at this point in the history
…ocol internal transport closing state so that StreamWriter.drain will invoke sleep(0) which calls connection_lost and correctly notifies waiters of connection lost. (python#118950)
  • Loading branch information
cjavad committed May 12, 2024
1 parent 5b941e5 commit ca05114
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Lib/asyncio/sslproto.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def get_protocol(self):
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.
Expand Down Expand Up @@ -379,6 +379,9 @@ def _get_app_transport(self):
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.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Let _SSLProtocolTransport.is_closing reflect SSLProtocol internal transport
closing state so that StreamWriter.drain will invoke sleep(0) which calls
connection_lost and correctly notifies waiters of connection lost.

0 comments on commit ca05114

Please sign in to comment.