8000 [3.7] bpo-33674: Pause the transport as early as possible (GH-7192) by miss-islington · Pull Request #7193 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.7] 8000 bpo-33674: Pause the transport as early as possible (GH-7192) #7193

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 1 commit into from
May 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 5 additions & 2 deletions Lib/asyncio/base_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -1106,10 +1106,13 @@ async def start_tls(self, transport, protocol, sslcontext, *,
ssl_handshake_timeout=ssl_handshake_timeout,
call_connection_made=False)

# Pause early so that "ssl_protocol.data_received()" doesn't
# have a chance to get called before "ssl_protocol.connection_made()".
transport.pause_reading()

transport.set_protocol(ssl_protocol)
self.call_soon(ssl_protocol.connection_made, transport)
if not transport.is_reading():
self.call_soon(transport.resume_reading)
self.call_soon(transport.resume_reading)

await waiter
return ssl_protocol._app_transport
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Pause the transport as early as possible to further reduce the risk of
data_received() being called before connection_made().
0