Open GoogleCodeExporter opened 9 years ago
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 gvanrossum@gmail.com
on 15 Nov 2013 at 9:42
Does create_connection() support servname for getaddrinfo() by the way?
@pavlix: Can you clarify the question?
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>)
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
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.
But who's going to write the patch?
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.
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.
Original issue reported on code.google.com by
gu...@dropbox.com
on 12 Nov 2013 at 10:10