lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sat, May 30, 2009 at 9:35 PM, Diego Nehab <diego@tecgraf.puc-rio.br> wrote:
> Hi,
>
>> It seems to me that connect() can block (30 seconds in my case) when
>> the DNS server for the domain is unreachable. I only discovered this
>> the other day and haven't managed to confirm the finding yet. If it's
>> true then it seems I need to switch DNS lookups for A records also to
>> our async DNS library...
>
> Yes, the DNS lookup can do that. What does an async DNS
> library look like?

It's a non-blocking wrapper[1] around a fixed and hacked up version[2]
of dns.lua[3]. A nice C replacement regularly features in our
dreams[4] :)

The catch is that we need to look up SRV records and need a reasonable
timeout, which the standard Linux resolver doesn't appear capable of.

> It seems as though you should have no
> trouble replacing the DNS lookup in LuaSocket with something
> else, without any changes to C code.
>

Oh so the DNS lookup is performed from inside LuaSocket? That greatly
simplifies things, thanks.

Matthew.

[1] http://prosody.im/source/hg/?file/tip/net/adns.lua
[2] http://prosody.im/source/hg/?file/tip/net/dns.lua
[3] http://ztact.com/software/dns.lua
[4] http://code.google.com/p/lxmppd/issues/detail?id=21