mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
asyncio: Fix _SelectorSocketTransport constructor
Only start reading when connection_made() has been called: protocol.data_received() must not be called before protocol.connection_made().
This commit is contained in:
parent
f07801bb17
commit
fa73779b0a
2 changed files with 14 additions and 6 deletions
|
@ -578,8 +578,10 @@ class _SelectorSocketTransport(_SelectorTransport):
|
|||
self._eof = False
|
||||
self._paused = False
|
||||
|
||||
self._loop.add_reader(self._sock_fd, self._read_ready)
|
||||
self._loop.call_soon(self._protocol.connection_made, self)
|
||||
# only start reading when connection_made() has been called
|
||||
self._loop.call_soon(self._loop.add_reader,
|
||||
self._sock_fd, self._read_ready)
|
||||
if waiter is not None:
|
||||
# only wake up the waiter when connection_made() has been called
|
||||
self._loop.call_soon(waiter._set_result_unless_cancelled, None)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue