From d4584664f787d8e3d0c92979e34b575f37e16df8 Mon Sep 17 00:00:00 2001 From: Florian Zeitz Date: Wed, 7 Dec 2011 23:37:56 +0100 Subject: s2smanager: Store port specified by SRV records --- core/s2smanager.lua | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'core/s2smanager.lua') diff --git a/core/s2smanager.lua b/core/s2smanager.lua index 77a1b040..08c1543b 100644 --- a/core/s2smanager.lua +++ b/core/s2smanager.lua @@ -295,11 +295,11 @@ function attempt_connection(host_session, err) return try_connect(host_session, connect_host, connect_port); end -function try_next_ip(host_session, connect_port) +function try_next_ip(host_session) host_session.connecting = nil; host_session.ip_choice = host_session.ip_choice + 1; local ip = host_session.ip_hosts[host_session.ip_choice]; - local ok, err= make_connect(host_session, ip, connect_port); + local ok, err= make_connect(host_session, ip.ip, ip.port); if not ok then if not attempt_connection(host_session, err or "closed") then err = err and (": "..err) or ""; @@ -354,8 +354,11 @@ function try_connect(host_session, connect_host, connect_port, err) if has_other then if #IPs > 0 then rfc3484_dest(host_session.ip_hosts, sources); + for i = 1, #IPs do + IPs[i] = {ip = IPs[i], port = connect_port}; + end host_session.ip_choice = 0; - try_next_ip(host_session, connect_port); + try_next_ip(host_session); else log("debug", "DNS lookup failed to get a response for %s", connect_host); host_session.ip_hosts = nil; @@ -383,8 +386,11 @@ function try_connect(host_session, connect_host, connect_port, err) if has_other then if #IPs > 0 then rfc3484_dest(host_session.ip_hosts, sources); + for i = 1, #IPs do + IPs[i] = {ip = IPs[i], port = connect_port}; + end host_session.ip_choice = 0; - try_next_ip(host_session, connect_port); + try_next_ip(host_session); else log("debug", "DNS lookup failed to get a response for %s", connect_host); host_session.ip_hosts = nil; @@ -401,7 +407,7 @@ function try_connect(host_session, connect_host, connect_port, err) return true; elseif host_session.ip_hosts and #host_session.ip_hosts > host_session.ip_choice then -- Not our first attempt, and we also have IPs left to try - try_next_ip(host_session, connect_port); + try_next_ip(host_session); else host_session.ip_hosts = nil; if not attempt_connection(host_session, "out of IP addresses") then -- Retry if we can -- cgit v1.2.3 From 8143f5ff1078d206364f661eeb04d8a071d34022 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Tue, 13 Dec 2011 15:40:37 +0000 Subject: s2smanager: Remove unused reference to modulemanager --- core/s2smanager.lua | 1 - 1 file changed, 1 deletion(-) (limited to 'core/s2smanager.lua') diff --git a/core/s2smanager.lua b/core/s2smanager.lua index 08c1543b..df5523e1 100644 --- a/core/s2smanager.lua +++ b/core/s2smanager.lua @@ -23,7 +23,6 @@ local idna_to_ascii = require "util.encodings".idna.to_ascii; local connlisteners_get = require "net.connlisteners".get; local initialize_filters = require "util.filters".initialize; local wrapclient = require "net.server".wrapclient; -local modulemanager = require "core.modulemanager"; local st = require "stanza"; local stanza = st.stanza; local nameprep = require "util.encodings".stringprep.nameprep; -- cgit v1.2.3 From 06aa3c416e58c67413522dd379f834262ca1b2fd Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Wed, 14 Dec 2011 06:46:24 +0500 Subject: s2smanager: Don't throw an error when the "interface" config option is a string (which it is by default). --- core/s2smanager.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'core/s2smanager.lua') diff --git a/core/s2smanager.lua b/core/s2smanager.lua index df5523e1..240b9ba8 100644 --- a/core/s2smanager.lua +++ b/core/s2smanager.lua @@ -319,6 +319,9 @@ function try_connect(host_session, connect_host, connect_port, err) if not sources then sources = {}; local cfg_sources = config.get("*", "core", "interface") or connlisteners_get("xmppserver").default_interface; + if type(cfg_sources) == "string" then + cfg_sources = { cfg_sources }; + end for i, source in ipairs(cfg_sources) do if source == "*" then sources[i] = new_ip("0.0.0.0", "IPv4"); -- cgit v1.2.3 From f5b0bf49fd4c6cc8ca82e356332620e9eb50cfb0 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Tue, 20 Dec 2011 17:36:38 +0000 Subject: s2smanager: Fix missing import of 'type' (thanks darkrain) --- core/s2smanager.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core/s2smanager.lua') diff --git a/core/s2smanager.lua b/core/s2smanager.lua index 240b9ba8..f44921c3 100644 --- a/core/s2smanager.lua +++ b/core/s2smanager.lua @@ -16,8 +16,8 @@ local socket = require "socket"; local format = string.format; local t_insert, t_sort = table.insert, table.sort; local get_traceback = debug.traceback; -local tostring, pairs, ipairs, getmetatable, newproxy, next, error, tonumber, setmetatable - = tostring, pairs, ipairs, getmetatable, newproxy, next, error, tonumber, setmetatable; +local tostring, pairs, ipairs, getmetatable, newproxy, type, error, tonumber, setmetatable + = tostring, pairs, ipairs, getmetatable, newproxy, type, error, tonumber, setmetatable; local idna_to_ascii = require "util.encodings".idna.to_ascii; local connlisteners_get = require "net.connlisteners".get; -- cgit v1.2.3