bpo-33674: asyncio: Fix SSLProtocol race (GH-7175) (GH-7188) · python/cpython@7593b8a (original) (raw)

2 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -574,7 +574,7 @@ def _start_handshake(self):
574 574 # (b'', 1) is a special value in _process_write_backlog() to do
575 575 # the SSL handshake
576 576 self._write_backlog.append((b'', 1))
577 -self._loop.call_soon(self._process_write_backlog)
577 +self._process_write_backlog()
578 578
579 579 def _on_handshake_complete(self, handshake_exc):
580 580 self._in_handshake = False
Original file line number Diff line number Diff 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.