diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-07-08 21:57:31 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-07-08 21:57:31 (GMT) |
commit | bfff45d611f3435ed4b713124f65fba8e961ff03 (patch) | |
tree | 752da659a58b6ac8178ff41a9d890cd83f2e7177 /Lib/asyncio/base_events.py | |
parent | aea82293be0a56937fe807a0d2a44c7db392f155 (diff) | |
download | cpython-bfff45d611f3435ed4b713124f65fba8e961ff03.zip cpython-bfff45d611f3435ed4b713124f65fba8e961ff03.tar.gz cpython-bfff45d611f3435ed4b713124f65fba8e961ff03.tar.bz2 |
asyncion, Tulip issue 181: BaseEventLoop.create_datagram_endpoint() now waits
until protocol.connection_made() has been called. Document also why transport
constructors use a waiter.
Diffstat (limited to 'Lib/asyncio/base_events.py')
-rw-r--r-- | Lib/asyncio/base_events.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py index 52c5517..833f81d 100644 --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -169,7 +169,7 @@ class BaseEventLoop(events.AbstractEventLoop): raise NotImplementedError def _make_datagram_transport(self, sock, protocol, - address=None, extra=None): + address=None, waiter=None, extra=None): """Create datagram transport.""" raise NotImplementedError @@ -605,7 +605,10 @@ class BaseEventLoop(events.AbstractEventLoop): raise exceptions[0] protocol = protocol_factory() - transport = self._make_datagram_transport(sock, protocol, r_addr) + waiter = futures.Future(loop=self) + transport = self._make_datagram_transport(sock, protocol, r_addr, + waiter) + yield from waiter return transport, protocol @coroutine |