summaryrefslogtreecommitdiff
path: root/asyncio/selector_events.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-01-29 00:18:18 +0100
committerVictor Stinner <victor.stinner@gmail.com>2015-01-29 00:18:18 +0100
commit6086246f41854b44ef1789fbfdaa167689c63f42 (patch)
treeeff3f6650a494c1d345504908c8b558976eb2564 /asyncio/selector_events.py
parentd409d7e5329b9968f39189c54b463397aa3d4a56 (diff)
downloadtrollius-6086246f41854b44ef1789fbfdaa167689c63f42.tar.gz
Fix _SelectorSocketTransport constructor
Only start reading when connection_made() has been called: protocol.data_received() must not be called before protocol.connection_made().
Diffstat (limited to 'asyncio/selector_events.py')
-rw-r--r--asyncio/selector_events.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/asyncio/selector_events.py b/asyncio/selector_events.py
index 42d88f5..f499629 100644
--- a/asyncio/selector_events.py
+++ b/asyncio/selector_events.py
@@ -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)