Skip to content

Commit d8c3743

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 d8c3743

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Lib/asyncio/sslproto.py

Lines changed: 4 additions & 1 deletion
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

0 commit comments

Comments
 (0)