Skip to content

Commit ca05114

Browse files
committed
gh-118950: 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. (#118950)
1 parent 5b941e5 commit ca05114

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Lib/asyncio/sslproto.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def get_protocol(self):
101101
return self._ssl_protocol._app_protocol
102102

103103
def is_closing(self):
104-
return self._closed
104+
return self._closed or self._ssl_protocol._is_transport_closing()
105105

106106
def close(self):
107107
"""Close the transport.
@@ -379,6 +379,9 @@ def _get_app_transport(self):
379379
self._app_transport_created = True
380380
return self._app_transport
381381

382+
def _is_transport_closing(self):
383+
return self._transport is not None and self._transport.is_closing()
384+
382385
def connection_made(self, transport):
383386
"""Called when the low-level connection is made.
384387
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Let _SSLProtocolTransport.is_closing reflect SSLProtocol internal transport
2+
closing state so that StreamWriter.drain will invoke sleep(0) which calls
3+
connection_lost and correctly notifies waiters of connection lost.

0 commit comments

Comments
 (0)