core/s2smanager.lua

changeset 3329
9adafeeadecb
parent 3312
12fc7e005e8b
child 3383
c7acddf80583
--- a/core/s2smanager.lua	Mon Jul 05 12:13:55 2010 +0100
+++ b/core/s2smanager.lua	Mon Jul 05 12:17:09 2010 +0100
@@ -42,9 +42,11 @@
 local adns, dns = require "net.adns", require "net.dns";
 local config = require "core.configmanager";
 local connect_timeout = config.get("*", "core", "s2s_timeout") or 60;
-local dns_timeout = config.get("*", "core", "dns_timeout") or 60;
+local dns_timeout = config.get("*", "core", "dns_timeout") or 15;
 local max_dns_depth = config.get("*", "core", "dns_max_depth") or 3;
 
+dns.settimeout(dns_timeout);
+
 incoming_s2s = {};
 _G.prosody.incoming_s2s = incoming_s2s;
 local incoming_s2s = incoming_s2s;
@@ -249,13 +251,6 @@
 			end
 		end, "_xmpp-server._tcp."..connect_host..".", "SRV");
 		
-		-- Set handler for DNS timeout
-		add_task(dns_timeout, function ()
-			if handle then
-				adns.cancel(handle, true);
-			end
-		end);
-		
 		return true; -- Attempt in progress
 	elseif host_session.srv_hosts and #host_session.srv_hosts > host_session.srv_choice then -- Not our first attempt, and we also have SRV
 		host_session.srv_choice = host_session.srv_choice + 1;
@@ -308,13 +303,6 @@
 		end
 	end, connect_host, "A", "IN");
 
-	-- Set handler for DNS timeout
-	add_task(dns_timeout, function ()
-		if handle then
-			adns.cancel(handle, true);
-		end
-	end);
-	
 	return true;
 end
 

mercurial