Comparison

plugins/mod_s2s/mod_s2s.lua @ 10613:74d66b1be989

mod_s2s: Pass use_ipv4/ipv6 from config to connector config
author Matthew Wild <mwild1@gmail.com>
date Fri, 24 Jan 2020 13:49:33 +0000
parent 10513:7a82f7ecf0ce
child 10622:0662fe0e2c31
comparison
equal deleted inserted replaced
10612:44ef46e1a951 10613:74d66b1be989
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 connect = require "net.connect".connect; 30 local new_connector = require "net.connect".new_connector;
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 });
53 58
54 module:hook("stats-update", function () 59 module:hook("stats-update", function ()
55 local count = 0; 60 local count = 0;
56 local ipv6 = 0; 61 local ipv6 = 0;
57 for _, session in pairs(sessions) do 62 for _, session in pairs(sessions) do