Mercurial > prosody-hg
comparison plugins/mod_s2s.lua @ 11742:9c450185bac1
mod_c2s,mod_s2s: Fire event just before writes
Could allow e.g. a XEP-0198 implementation to efficiently send ack
requests at optimal times without using timers or nextTick.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Mon, 16 Aug 2021 12:45:14 +0200 |
| parents | b92f2abe0bda |
| children | d2a9aa1c7ac8 |
comparison
equal
deleted
inserted
replaced
| 11741:dcf38ac6a38c | 11742:9c450185bac1 |
|---|---|
| 858 if session then | 858 if session then |
| 859 return (hosts[session.host] or prosody).events.fire_event("s2s-ondrain", { session = session }); | 859 return (hosts[session.host] or prosody).events.fire_event("s2s-ondrain", { session = session }); |
| 860 end | 860 end |
| 861 end | 861 end |
| 862 | 862 |
| 863 function listener.onpredrain(conn) | |
| 864 local session = sessions[conn]; | |
| 865 if session then | |
| 866 return (hosts[session.host] or prosody).events.fire_event("s2s-pre-ondrain", { session = session }); | |
| 867 end | |
| 868 end | |
| 869 | |
| 863 function listener.register_outgoing(conn, session) | 870 function listener.register_outgoing(conn, session) |
| 864 sessions[conn] = session; | 871 sessions[conn] = session; |
| 865 initialize_session(session); | 872 initialize_session(session); |
| 866 end | 873 end |
| 867 | 874 |
