summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2018-05-29 05:00:12 (GMT)
committerGitHub <noreply@github.com>2018-05-29 05:00:12 (GMT)
commitf295587c45f96b62d24f9a12cef6931b0805f596 (patch)
tree3a33afc7269203486b79f0f3e5b1a7d2d7e83be1 /Lib/asyncio
parent3e51a3d5927c680d5410ff11ff8d5e5bb9ffb1e7 (diff)
downloadcpython-f295587c45f96b62d24f9a12cef6931b0805f596.zip
cpython-f295587c45f96b62d24f9a12cef6931b0805f596.tar.gz
cpython-f295587c45f96b62d24f9a12cef6931b0805f596.tar.bz2
bpo-33674: Pause the transport as early as possible (#7192)
Diffstat (limited to 'Lib/asyncio')
-rw-r--r--Lib/asyncio/base_events.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py
index ffd2513..61938e9 100644
--- a/Lib/asyncio/base_events.py
+++ b/Lib/asyncio/base_events.py
@@ -1106,10 +1106,13 @@ class BaseEventLoop(events.AbstractEventLoop):
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