Software /
code /
prosody
Comparison
plugins/mod_s2s/mod_s2s.lua @ 10625:3bfb20be844c
mod_s2s: Pass use_ipv4/use_ipv6 from config to service resolver
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 25 Jan 2020 14:38:42 +0000 |
parent | 10622:0662fe0e2c31 |
child | 10632:c9de8275aaf2 |
comparison
equal
deleted
inserted
replaced
10624:0725b7b8dc14 | 10625:3bfb20be844c |
---|---|
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 s2s_service_options = { | |
55 default_port = 5269; | |
56 use_ipv4 = module:get_option_boolean("use_ipv4", true); | |
57 use_ipv6 = module:get_option_boolean("use_ipv6", true); | |
58 }; | |
53 | 59 |
54 module:hook("stats-update", function () | 60 module:hook("stats-update", function () |
55 local count = 0; | 61 local count = 0; |
56 local ipv6 = 0; | 62 local ipv6 = 0; |
57 for _, session in pairs(sessions) do | 63 for _, session in pairs(sessions) do |
163 | 169 |
164 -- Store in buffer | 170 -- Store in buffer |
165 host_session.bounce_sendq = bounce_sendq; | 171 host_session.bounce_sendq = bounce_sendq; |
166 host_session.sendq = { {tostring(stanza), stanza.attr.type ~= "error" and stanza.attr.type ~= "result" and st.reply(stanza)} }; | 172 host_session.sendq = { {tostring(stanza), stanza.attr.type ~= "error" and stanza.attr.type ~= "result" and st.reply(stanza)} }; |
167 log("debug", "stanza [%s] queued until connection complete", stanza.name); | 173 log("debug", "stanza [%s] queued until connection complete", stanza.name); |
168 connect(service.new(to_host, "xmpp-server", "tcp", { default_port = 5269 }), listener, nil, { session = host_session }); | 174 connect(service.new(to_host, "xmpp-server", "tcp", s2s_service_options), listener, nil, { session = host_session }); |
169 return true; | 175 return true; |
170 end | 176 end |
171 | 177 |
172 local function keepalive(event) | 178 local function keepalive(event) |
173 return event.session.sends2s(' '); | 179 return event.session.sends2s(' '); |