aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorFlorian Zeitz <florob@babelmonkeys.de>2012-02-24 15:24:10 +0000
committerFlorian Zeitz <florob@babelmonkeys.de>2012-02-24 15:24:10 +0000
commit35ddcf0af31198baef0f4ce2e580b041486d5194 (patch)
treef699d4837d4a8dfd06e1a2a7a59f9b36ec157be4 /plugins
parenteda5f26eb482f9f74949248f0fd9bd60e4f5580d (diff)
downloadprosody-35ddcf0af31198baef0f4ce2e580b041486d5194.tar.gz
prosody-35ddcf0af31198baef0f4ce2e580b041486d5194.zip
s2sout.lib: import utils/functionality once in s2smanager.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/s2s/s2sout.lib.lua16
1 files changed, 14 insertions, 2 deletions
diff --git a/plugins/s2s/s2sout.lib.lua b/plugins/s2s/s2sout.lib.lua
index 094126e7..12669d97 100644
--- a/plugins/s2s/s2sout.lib.lua
+++ b/plugins/s2s/s2sout.lib.lua
@@ -8,13 +8,24 @@
--- Module containing all the logic for connecting to a remote server
+local t_insert = table.insert;
+local t_sort = table.sort;
+local ipairs = ipairs;
+
+local wrapclient = require "net.server".wrapclient;
local initialize_filters = require "util.filters".initialize;
local idna_to_ascii = require "util.encodings".idna.to_ascii;
local add_task = require "util.timer".add_task;
+local st = require "util.stanza";
+local new_ip = require "util.ip".new_ip;
+local rfc3484_dest = require "util.rfc3484".destination;
local socket = require "socket";
+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();
+
local s2sout = {};
local s2s_listener;
@@ -36,7 +47,7 @@ end
function s2sout.initiate_connection(host_session)
initialize_filters(host_session);
- session.open_stream = session_open_stream;
+ host_session.open_stream = session_open_stream;
-- Kick the connection attempting machine into life
if not s2sout.attempt_connection(host_session) then
@@ -147,6 +158,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
@@ -156,7 +168,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");