Skip to content
This repository has been archived by the owner on Nov 23, 2017. It is now read-only.

Implement "Happy Eyeballs" (RFC 6555) for dual-stack create_connection() #86

Open
GoogleCodeExporter opened this issue Apr 10, 2015 · 9 comments

Comments

@GoogleCodeExporter
Copy link

See http://tools.ietf.org/html/rfc6555

See also the HostnameEndpoint class in Twisted (new in Twisted 13.2).

Original issue reported on code.google.com by [email protected] on 12 Nov 2013 at 10:10

@GoogleCodeExporter
Copy link
Author

Note that the RFC requires caching the info about whether IPv6 works or not for 
a particular destination address (host+port). The cache should time out after 
10 minutes. It also requires preferring IPv6 (if it is the first address 
returned by getaddrinfo()). It also specifies using a delay of 150-250 msec in 
case no cache is used.

Original comment by [email protected] on 15 Nov 2013 at 9:42

@pavlix
Copy link

pavlix commented Feb 5, 2016

Does create_connection() support servname for getaddrinfo() by the way?

@gvanrossum
Copy link
Member

@pavlix: Can you clarify the question?

@ajdavis
Copy link

ajdavis commented Feb 5, 2016

If I understand correctly, the answer's "yes", asyncio supports the same args to create_connection as the standard socket.getaddrinfo call does. The "port" argument maps to the POSIX getaddrinfo argument "servname", which can be an actual port or a service name like "http":

>>> import asyncio
>>> class MyProto(asyncio.Protocol):
...     pass
...     
>>> loop = asyncio.get_event_loop()
>>> future = loop.create_connection(MyProto, 'python.org', 'http')
>>> loop.run_until_complete(future)
(<_SelectorSocketTransport fd=7 read=polling write=<idle, bufsize=0>>, <MyProto object at 0x1046687f0>)

@pavlix
Copy link

pavlix commented Feb 6, 2016

Exactly as @adjavis wrote. I'm writing tests for various IPv4/IPv6 configuration with careful syscall checks and I have just added support for python using getaddrinfo() and sockets (link). Looks like it's also time to add a asyncio based test

pavlix pushed a commit to crossdistro/network-testing that referenced this issue Feb 6, 2016
@pavlix
Copy link

pavlix commented Feb 6, 2016

So I know have the test using asyncio and can easily confirm that fallback to IPv4 is delayed by an actual IPv6 TCP timeout. Let me know if I can help testing the feature.

@gvanrossum
Copy link
Member

gvanrossum commented Feb 6, 2016 via email

@pavlix
Copy link

pavlix commented Feb 6, 2016

I don't want to make false promises and the test linked above was my first asyncio code ever. But I would consider it unless someone does it first.

@pavlix
Copy link

pavlix commented Feb 6, 2016

Also, I will definitely be implementing the happy eyeballs RFC in C in the netresolve project which already supports a non-standard variant of happy eyeballs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants