summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authortwisteroid ambassador <twisteroidambassador@users.noreply.github.com>2019-05-05 11:14:35 (GMT)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-05-05 11:14:35 (GMT)
commit88f07a804a0adc0b6ee87687b59d8416113c7331 (patch)
treee7fcadefb5269eb9b03c5c5946a31387ab7839e7 /Doc/library
parentc4d92c8ada7ecfc479ebb1dd4a819c9202155970 (diff)
downloadcpython-88f07a804a0adc0b6ee87687b59d8416113c7331.zip
cpython-88f07a804a0adc0b6ee87687b59d8416113c7331.tar.gz
cpython-88f07a804a0adc0b6ee87687b59d8416113c7331.tar.bz2
bpo-33530: Implement Happy Eyeballs in asyncio, v2 (GH-7237)
Added two keyword arguments, `delay` and `interleave`, to `BaseEventLoop.create_connection`. Happy eyeballs is activated if `delay` is specified. We now have documentation for the new arguments. `staggered_race()` is in its own module, but not exported to the main asyncio package. https://bugs.python.org/issue33530
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/asyncio-eventloop.rst24
1 files changed, 23 insertions, 1 deletions
diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst
index e2b3124..06f673b 100644
--- a/Doc/library/asyncio-eventloop.rst
+++ b/Doc/library/asyncio-eventloop.rst
@@ -397,9 +397,27 @@ Opening network connections
If given, these should all be integers from the corresponding
:mod:`socket` module constants.
+ * *happy_eyeballs_delay*, if given, enables Happy Eyeballs for this
+ connection. It should
+ be a floating-point number representing the amount of time in seconds
+ to wait for a connection attempt to complete, before starting the next
+ attempt in parallel. This is the "Connection Attempt Delay" as defined
+ in :rfc:`8305`. A sensible default value recommended by the RFC is ``0.25``
+ (250 milliseconds).
+
+ * *interleave* controls address reordering when a host name resolves to
+ multiple IP addresses.
+ If ``0`` or unspecified, no reordering is done, and addresses are
+ tried in the order returned by :meth:`getaddrinfo`. If a positive integer
+ is specified, the addresses are interleaved by address family, and the
+ given integer is interpreted as "First Address Family Count" as defined
+ in :rfc:`8305`. The default is ``0`` if *happy_eyeballs_delay* is not
+ specified, and ``1`` if it is.
+
* *sock*, if given, should be an existing, already connected
:class:`socket.socket` object to be used by the transport.
- If *sock* is given, none of *host*, *port*, *family*, *proto*, *flags*
+ If *sock* is given, none of *host*, *port*, *family*, *proto*, *flags*,
+ *happy_eyeballs_delay*, *interleave*
and *local_addr* should be specified.
* *local_addr*, if given, is a ``(local_host, local_port)`` tuple used
@@ -410,6 +428,10 @@ Opening network connections
to wait for the TLS handshake to complete before aborting the connection.
``60.0`` seconds if ``None`` (default).
+ .. versionadded:: 3.8
+
+ The *happy_eyeballs_delay* and *interleave* parameters.
+
.. versionadded:: 3.7
The *ssl_handshake_timeout* parameter.