Comparison

plugins/mod_s2s.lua @ 13110:d5f322dd424b 0.12

mod_s2s: Add event where resolver for s2sout can be tweaked Could be used to implement custom connection methods (c.f. mod_onions) without needing to duplicate the rest of route_to_new_session(). Adds a feature to enable detection since it can be difficult to detect support for an event otherwise.
author Kim Alvefur <zash@zash.se>
date Thu, 18 Aug 2022 03:26:32 +0200
parent 12679:7d4a95ba9b6c
child 13111:8576f94ac90a
comparison
equal deleted inserted replaced
13091:214a679823e8 13110:d5f322dd424b
228 resolver = resolver_chain.new({ 228 resolver = resolver_chain.new({
229 service.new(to_host, "xmpps-server", "tcp", xmpps_extra); 229 service.new(to_host, "xmpps-server", "tcp", xmpps_extra);
230 resolver; 230 resolver;
231 }); 231 });
232 end 232 end
233
234 local pre_event = { session = host_session; resolver = resolver };
235 module:context(from_host):fire_event("s2sout-pre-connect", pre_event);
236 resolver = pre_event.resolver;
233 connect(resolver, listener, nil, { session = host_session }); 237 connect(resolver, listener, nil, { session = host_session });
234 m_initiated_connections:with_labels(from_host):add(1) 238 m_initiated_connections:with_labels(from_host):add(1)
235 return true; 239 return true;
236 end 240 end
237 241