aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/s2s/s2sout.lib.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2012-02-24 16:23:46 +0000
committerMatthew Wild <mwild1@gmail.com>2012-02-24 16:23:46 +0000
commitb26626109f7bbe808303787f619b67cb64792269 (patch)
treede23e9acf420ce5ae271837be41e71f46350c79c /plugins/s2s/s2sout.lib.lua
parentddef415e167351b9197a06bfd1d401e70dd37e13 (diff)
parent0f9c104f0cb7f20a63bf6f890d0d04a690418a1d (diff)
downloadprosody-b26626109f7bbe808303787f619b67cb64792269.tar.gz
prosody-b26626109f7bbe808303787f619b67cb64792269.zip
Merge Zash with Florob and Maranda
Diffstat (limited to 'plugins/s2s/s2sout.lib.lua')
-rw-r--r--plugins/s2s/s2sout.lib.lua11
1 files changed, 6 insertions, 5 deletions
diff --git a/plugins/s2s/s2sout.lib.lua b/plugins/s2s/s2sout.lib.lua
index 64786862..808c7e74 100644
--- a/plugins/s2s/s2sout.lib.lua
+++ b/plugins/s2s/s2sout.lib.lua
@@ -15,18 +15,18 @@ local add_task = require "util.timer".add_task;
local new_ip = require "util.ip".new_ip;
local rfc3484_dest = require "util.rfc3484".destination;
local socket = require "socket";
-local t_insert, t_sort = table.insert, table.sort;
+local t_insert, t_sort, ipairs = table.insert, table.sort, ipairs;
local st = require "util.stanza";
-local s2s_destroy_session = require "core.s2smanager".destroy_session;
local s2s_new_outgoing = require "core.s2smanager".new_outgoing;
+local s2s_destroy_session = require "core.s2smanager".destroy_session;
+
+local cfg_sources = config.get("*", "core", "s2s_interfaces") or socket.local_addresses and socket.local_addresses() or { "*" };
local s2sout = {};
local s2s_listener;
-local cfg_sources = config.get("*", "core", "s2s_interfaces") or {"*"};
-local sources
function s2sout.set_listener(listener)
s2s_listener = listener;
@@ -156,6 +156,7 @@ function s2sout.try_next_ip(host_session)
end
function s2sout.try_connect(host_session, connect_host, connect_port, err)
+ local sources;
host_session.connecting = true;
if not err then
@@ -165,7 +166,7 @@ function s2sout.try_connect(host_session, connect_host, connect_port, err)
local has_other = false;
if not sources then
- sources = {};
+ sources = {};
for i, source in ipairs(cfg_sources) do
if source == "*" then
sources[i] = new_ip("0.0.0.0", "IPv4");