diff options
author | Florian Zeitz <florob@babelmonkeys.de> | 2012-02-24 15:24:10 +0000 |
---|---|---|
committer | Florian Zeitz <florob@babelmonkeys.de> | 2012-02-24 15:24:10 +0000 |
commit | 3552b31a4fac765a6b5bca81f869423079c2073f (patch) | |
tree | f699d4837d4a8dfd06e1a2a7a59f9b36ec157be4 /plugins/s2s | |
parent | 48f64ab12c78907e4f85bb1c6dc02c297999cc55 (diff) | |
download | prosody-3552b31a4fac765a6b5bca81f869423079c2073f.tar.gz prosody-3552b31a4fac765a6b5bca81f869423079c2073f.zip |
s2sout.lib: import utils/functionality once in s2smanager.
Diffstat (limited to 'plugins/s2s')
-rw-r--r-- | plugins/s2s/s2sout.lib.lua | 16 |
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"); |