summaryrefslogtreecommitdiff
path: root/asyncio/selector_events.py
diff options
context:
space:
mode:
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 f499629..5fe46e5 100644
--- a/asyncio/selector_events.py
+++ b/asyncio/selector_events.py
@@ -928,8 +928,10 @@ class _SelectorDatagramTransport(_SelectorTransport):
waiter=None, extra=None):
super().__init__(loop, sock, protocol, extra)
self._address = address
- 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)