8000 bpo-33674: asyncio: Fix SSLProtocol race (GH-7175) (GH-7188) · python/cpython@7593b8a · GitHub
[go: up one dir, main page]

Skip to content

Commit 7593b8a

Browse files
vstinner1st1
authored andcommitted
bpo-33674: asyncio: Fix SSLProtocol race (GH-7175) (GH-7188)
Fix a race condition in SSLProtocol.connection_made() of asyncio.sslproto: start immediately the handshake instead of using call_soon(). Previously, data_received() could be called before the handshake started, causing the handshake to hang or fail. (cherry picked from commit be00a55)
1 parent 325320d commit 7593b8a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Lib/asyncio/sslproto.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ def _start_handshake(self):
574574
# (b'', 1) is a special value in _process_write_backlog() to do
575575
# the SSL handshake
576576
self._write_backlog.append((b'', 1))
577-
self._loop.call_soon(self._process_write_backlog)
577+
self._process_write_backlog()
578578

579579
def _on_handshake_complete(self, handshake_exc):
580580
self._in_handshake = False
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Fix a race condition in SSLProtocol.connection_made() of asyncio.sslproto:
2+
start immediately the handshake instead of using call_soon(). Previously,
3+
data_received() could be called before the handshake started, causing the
4+
handshake to hang or fail.

0 commit comments

Comments
 (0)
0