From be00a5583a2cb696335c527b921d1868266a42c6 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 29 May 2018 01:33:35 +0200 Subject: bpo-33674: asyncio: Fix SSLProtocol race (GH-7175) 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. --- Lib/asyncio/sslproto.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Lib/asyncio/sslproto.py') diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py index 2bfa45dd15..ab43e93b28 100644 --- a/Lib/asyncio/sslproto.py +++ b/Lib/asyncio/sslproto.py @@ -592,10 +592,10 @@ class SSLProtocol(protocols.Protocol): # (b'', 1) is a special value in _process_write_backlog() to do # the SSL handshake self._write_backlog.append((b'', 1)) - self._loop.call_soon(self._process_write_backlog) self._handshake_timeout_handle = \ self._loop.call_later(self._ssl_handshake_timeout, self._check_handshake_timeout) + self._process_write_backlog() def _check_handshake_timeout(self): if self._in_handshake is True: -- cgit v1.2.1