2014-03-27 9:25 GMT+01:00 Saúl Ibarra Corretgé <[email protected]>:
> I'd also like to support Trollius. I guess using yield From(fut) would
> do, right? But how does one get around the syntax error on Python <
> 3.3, if at all possible?

You can use the callback API which is the same in Tulip and Trollius:
http://trollius.readthedocs.org/#write-code-working-on-trollius-and-tulip

Or you have to duplicate some parts of your code and use "if python <
3.3: ... else: ...". It may be possible to do that in the same file
using exec(), which is ugly. Or using two different Python files and
import.

>> http://code.google.com/p/tulip/issues/detail?id=160
>
> There is a small problem with that. For the most part, what people
> need is getaddrinfo, which c-ares doesn't have, so I'd have to
> 'emulate' it by running it on a thread. The problem is that the
> parameters that were used to configure the Ares channel (nameservers,
> timeout, ... [0]) wouldn't apply to getaddrinfo.

I implemented getaddrinfo() using pycares without threads:
https://bitbucket.org/haypo/asyncio_staging/src/tip/resolver_cares.py

It's not well tested, I'm not sure that I pass the right flags.

pycares is used to resolve IPv4 and IPv6 addresses. For other
families, the code falls back to socket.getaddrinfo() called in the
executor (asyncio default implementation). Maybe an exception could be
raised instead?

> http://daniel.haxx.se/blog/2012/01/03/getaddrinfo-with-round-robin-dns-and-happy-eyeballs/

For the happy eyeball, asyncio API must be modified because
create_connection() currently "blocks" until getaddrinfo() returns all
IPv4 and all IPv6 addresses. There is an issue but no implementation
yet:
http://code.google.com/p/tulip/issues/detail?id=86

Victor

Reply via email to