8000 gh-118950: Fix SSLProtocol.connection_lost not being called when OSError is thrown on asyncio.write. by cjavad · Pull Request #118960 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content
8000

gh-118950: Fix SSLProtocol.connection_lost not being called when OSError is thrown on asyncio.write. #118960

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
gh-118950: Let _SSLProtocolTransport.is_closing reflect SSLProtocol i…
…nternal transport closing state so that StreamWriter.drain will invoke sleep(0) which calls connection_lost and correctly notifies waiters of connection lost. (#118950)
  • Loading branch information
cjavad committed May 12, 2024
commit ca0511442db173714a8d056f51a54245023bf243
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.
Loading
0