Mercurial > prosody-hg
diff plugins/mod_s2s.lua @ 13985:e3ef3e684855
mod_s2s: Optimize order of table accesses
No need to fetch hosts[to] multiple times if we just load it into a
local earlier
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 14 Oct 2025 22:12:51 +0200 |
| parents | 8e6baa66f828 |
| children | 4067a95336dd |
line wrap: on
line diff
--- a/plugins/mod_s2s.lua Fri Oct 10 23:46:19 2025 +0200 +++ b/plugins/mod_s2s.lua Tue Oct 14 22:12:51 2025 +0200 @@ -370,11 +370,11 @@ end else - if session.outgoing and not hosts[to].s2sout[from] then + local host_session = hosts[to]; + if session.outgoing and not host_session.s2sout[from] then session.log("debug", "Setting up to handle route from %s to %s", to, from); - hosts[to].s2sout[from] = session; -- luacheck: ignore 122 + host_session.s2sout[from] = session; -- luacheck: ignore 122 end - local host_session = hosts[to]; session.send = function(stanza) return host_session.events.fire_event("route/remote", { from_host = to, to_host = from, stanza = stanza }); end;
