diff options
author | Matthew Wild <mwild1@gmail.com> | 2010-02-18 16:44:26 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2010-02-18 16:44:26 +0000 |
commit | f2a5185e0074e220759ccc35ca897d6d948cb219 (patch) | |
tree | 6e48a873119267d3a0097bdad12e5fd02ebc2876 /net/adns.lua | |
parent | ec83dc97eea39c0dc3e16eabee81b2fdf1f7bc60 (diff) | |
download | prosody-f2a5185e0074e220759ccc35ca897d6d948cb219.tar.gz prosody-f2a5185e0074e220759ccc35ca897d6d948cb219.zip |
net.adns: Don't treat locally-initiated disconnects as fatal with libevent backend in use (thanks Flo)
Diffstat (limited to 'net/adns.lua')
-rw-r--r-- | net/adns.lua | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/net/adns.lua b/net/adns.lua index d1876b0f..0121881a 100644 --- a/net/adns.lua +++ b/net/adns.lua @@ -54,13 +54,15 @@ function new_async_socket(sock, resolver) end end function listener.ondisconnect(conn, err) - log("warn", "DNS socket for %s disconnected: %s", peername, err); - local servers = resolver.server; - if resolver.socketset[conn] == resolver.best_server and resolver.best_server == #servers then - log("error", "Exhausted all %d configured DNS servers, next lookup will try %s again", #servers, servers[1]); - end + if err then + log("warn", "DNS socket for %s disconnected: %s", peername, err); + local servers = resolver.server; + if resolver.socketset[conn] == resolver.best_server and resolver.best_server == #servers then + log("error", "Exhausted all %d configured DNS servers, next lookup will try %s again", #servers, servers[1]); + end - resolver:servfail(conn); -- Let the magic commence + resolver:servfail(conn); -- Let the magic commence + end end handler = server.wrapclient(sock, "dns", 53, listener); if not handler then |