Changeset

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
parents 2660:9e5b21b7b2f9
children 2662:6877179335a9 2663:b3d1c4985182
files net/adns.lua
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
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