aboutsummaryrefslogtreecommitdiffstats
path: root/core/s2smanager.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-07-05 12:17:09 +0100
committerMatthew Wild <mwild1@gmail.com>2010-07-05 12:17:09 +0100
commit56c310f30c0bc9af0bc394719a1960e37677fb6e (patch)
tree0e7cb86c1475b7ed742b429316d95d47ded18634 /core/s2smanager.lua
parent90b0ef76c687a4c819f9487a35f5f615d2a2f7db (diff)
downloadprosody-56c310f30c0bc9af0bc394719a1960e37677fb6e.tar.gz
prosody-56c310f30c0bc9af0bc394719a1960e37677fb6e.zip
s2smanager: Lower default DNS timeout to 15s (it's now a per-DNS-server timeout, rather than total timeout), use net.dns's new timeout system, and remove our custom timeout handlers
Diffstat (limited to 'core/s2smanager.lua')
-rw-r--r--core/s2smanager.lua18
1 files changed, 3 insertions, 15 deletions
diff --git a/core/s2smanager.lua b/core/s2smanager.lua
index 9d29689f..f3cde4b7 100644
--- a/core/s2smanager.lua
+++ b/core/s2smanager.lua
@@ -42,9 +42,11 @@ local sha256_hash = require "util.hashes".sha256;
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 @@ function attempt_connection(host_session, err)
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 @@ function try_connect(host_session, connect_host, connect_port)
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