Software /
code /
prosody
Diff
net/adns.lua @ 2661:be4b1e796bd2
net.adns: Don't treat locally-initiated disconnects as fatal with libevent backend in use (thanks Flo)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 18 Feb 2010 16:44:26 +0000 |
parent | 2652:cbc58fc170ad |
child | 2714:9c5d8e0c146e |
line wrap: on
line diff
--- a/net/adns.lua Thu Feb 18 16:41:53 2010 +0000 +++ b/net/adns.lua Thu Feb 18 16:44:26 2010 +0000 @@ -54,13 +54,15 @@ 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]); + 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 end - - resolver:servfail(conn); -- Let the magic commence end handler = server.wrapclient(sock, "dns", 53, listener); if not handler then