Comparison

plugins/mod_s2s/mod_s2s.lua @ 10622:0662fe0e2c31

Backed out changeset 74d66b1be989 (not optimal API)
author Matthew Wild <mwild1@gmail.com>
date Sat, 25 Jan 2020 14:25:21 +0000
parent 10613:74d66b1be989
child 10625:3bfb20be844c
comparison
equal deleted inserted replaced
10621:e5ab31845094 10622:0662fe0e2c31
25 local s2s_new_outgoing = require "core.s2smanager".new_outgoing; 25 local s2s_new_outgoing = require "core.s2smanager".new_outgoing;
26 local s2s_destroy_session = require "core.s2smanager".destroy_session; 26 local s2s_destroy_session = require "core.s2smanager".destroy_session;
27 local uuid_gen = require "util.uuid".generate; 27 local uuid_gen = require "util.uuid".generate;
28 local fire_global_event = prosody.events.fire_event; 28 local fire_global_event = prosody.events.fire_event;
29 local runner = require "util.async".runner; 29 local runner = require "util.async".runner;
30 local new_connector = require "net.connect".new_connector; 30 local connect = require "net.connect".connect;
31 local service = require "net.resolvers.service"; 31 local service = require "net.resolvers.service";
32 local errors = require "util.error"; 32 local errors = require "util.error";
33 local set = require "util.set"; 33 local set = require "util.set";
34 34
35 local connect_timeout = module:get_option_number("s2s_timeout", 90); 35 local connect_timeout = module:get_option_number("s2s_timeout", 90);
48 local runner_callbacks = {}; 48 local runner_callbacks = {};
49 49
50 local listener = {}; 50 local listener = {};
51 51
52 local log = module._log; 52 local log = module._log;
53
54 local connect = new_connector({
55 use_ipv4 = module:get_option_boolean("use_ipv4", true);
56 use_ipv6 = module:get_option_boolean("use_ipv6", true);
57 });
58 53
59 module:hook("stats-update", function () 54 module:hook("stats-update", function ()
60 local count = 0; 55 local count = 0;
61 local ipv6 = 0; 56 local ipv6 = 0;
62 for _, session in pairs(sessions) do 57 for _, session in pairs(sessions) do