diff options
author | Kim Alvefur <zash@zash.se> | 2021-07-18 21:53:26 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2021-07-18 21:53:26 +0200 |
commit | fa25e086f490c84f0aaca3bc2ad125f402add6b0 (patch) | |
tree | 99eded28920761e4ba0943df4e0d1302800162e3 /plugins | |
parent | d1d96f93d15e5884093552965d5ed56c90c667d3 (diff) | |
download | prosody-fa25e086f490c84f0aaca3bc2ad125f402add6b0.tar.gz prosody-fa25e086f490c84f0aaca3bc2ad125f402add6b0.zip |
mod_s2s: Clone 'extra' data to let resolvers add more to it
This way 'extra' is unique for each connect() instance, making it safer
to mutate it, while inheriting the global settings.
See 926d53af9a7a for some more context.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_s2s.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/mod_s2s.lua b/plugins/mod_s2s.lua index 67adc0e0..1e0fb955 100644 --- a/plugins/mod_s2s.lua +++ b/plugins/mod_s2s.lua @@ -91,6 +91,7 @@ local s2s_service_options = { use_ipv6 = module:get_option_boolean("use_ipv6", true); use_dane = module:get_option_boolean("use_dane", false); }; +local s2s_service_options_mt = { __index = s2s_service_options } module:hook("stats-update", function () measure_connections_inbound:clear() @@ -214,7 +215,10 @@ function route_to_new_session(event) host_session.bounce_sendq = bounce_sendq; host_session.sendq = { {tostring(stanza), stanza.attr.type ~= "error" and stanza.attr.type ~= "result" and st.reply(stanza)} }; log("debug", "stanza [%s] queued until connection complete", stanza.name); - connect(service.new(to_host, "xmpp-server", "tcp", s2s_service_options), listener, nil, { session = host_session }); + -- FIXME Cleaner solution to passing extra data from resolvers to net.server + -- This mt-clone allows resolvers to add extra data, currently used for DANE TLSA records + local extra = setmetatable({}, s2s_service_options_mt); + connect(service.new(to_host, "xmpp-server", "tcp", extra), listener, nil, { session = host_session }); m_initiated_connections:with_labels(from_host):add(1) return true; end |