mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
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.
This commit is contained in:
parent
8c1ad0c4f6
commit
be00a5583a
2 changed files with 5 additions and 1 deletions
|
@ -592,10 +592,10 @@ class SSLProtocol(protocols.Protocol):
|
||||||
# (b'', 1) is a special value in _process_write_backlog() to do
|
# (b'', 1) is a special value in _process_write_backlog() to do
|
||||||
# the SSL handshake
|
# the SSL handshake
|
||||||
self._write_backlog.append((b'', 1))
|
self._write_backlog.append((b'', 1))
|
||||||
self._loop.call_soon(self._process_write_backlog)
|
|
||||||
self._handshake_timeout_handle = \
|
self._handshake_timeout_handle = \
|
||||||
self._loop.call_later(self._ssl_handshake_timeout,
|
self._loop.call_later(self._ssl_handshake_timeout,
|
||||||
self._check_handshake_timeout)
|
self._check_handshake_timeout)
|
||||||
|
self._process_write_backlog()
|
||||||
|
|
||||||
def _check_handshake_timeout(self):
|
def _check_handshake_timeout(self):
|
||||||
if self._in_handshake is True:
|
if self._in_handshake is True:
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
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.
|
Loading…
Add table
Add a link
Reference in a new issue