Mercurial > prosody-hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 13984:70de03ca79a8 | 13985:e3ef3e684855 |
|---|---|
| 368 return module:context(from):fire_event("route/remote", { from_host = from, to_host = to, stanza = stanza }); | 368 return module:context(from):fire_event("route/remote", { from_host = from, to_host = to, stanza = stanza }); |
| 369 end; | 369 end; |
| 370 end | 370 end |
| 371 | 371 |
| 372 else | 372 else |
| 373 if session.outgoing and not hosts[to].s2sout[from] then | 373 local host_session = hosts[to]; |
| 374 if session.outgoing and not host_session.s2sout[from] then | |
| 374 session.log("debug", "Setting up to handle route from %s to %s", to, from); | 375 session.log("debug", "Setting up to handle route from %s to %s", to, from); |
| 375 hosts[to].s2sout[from] = session; -- luacheck: ignore 122 | 376 host_session.s2sout[from] = session; -- luacheck: ignore 122 |
| 376 end | 377 end |
| 377 local host_session = hosts[to]; | |
| 378 session.send = function(stanza) | 378 session.send = function(stanza) |
| 379 return host_session.events.fire_event("route/remote", { from_host = to, to_host = from, stanza = stanza }); | 379 return host_session.events.fire_event("route/remote", { from_host = to, to_host = from, stanza = stanza }); |
| 380 end; | 380 end; |
| 381 | 381 |
| 382 module:fire_event("s2sin-established", event_data); | 382 module:fire_event("s2sin-established", event_data); |
