Software /
code /
prosody
Diff
plugins/mod_s2s/mod_s2s.lua @ 5669:9345c161481f
mod_c2s, mod_s2s: Fire an event on read timeouts
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 11 Jun 2013 21:36:15 +0200 |
parent | 5661:f226a0d23e85 |
child | 5713:5cf6dedf36f4 |
line wrap: on
line diff
--- a/plugins/mod_s2s/mod_s2s.lua Tue Jun 11 21:18:51 2013 +0200 +++ b/plugins/mod_s2s/mod_s2s.lua Tue Jun 11 21:36:15 2013 +0200 @@ -135,6 +135,10 @@ return true; end +local function keepalive(event) + return event.session.sends2s(' '); +end + function module.add_host(module) if module:get_option_boolean("disallow_s2s", false) then module:log("warn", "The 'disallow_s2s' config option is deprecated, please see http://prosody.im/doc/s2s#disabling"); @@ -143,6 +147,7 @@ module:hook("route/remote", route_to_existing_session, -1); module:hook("route/remote", route_to_new_session, -10); module:hook("s2s-authenticated", make_authenticated, -1); + module:hook("s2s-read-timeout", keepalive, -1); end -- Stream is authorised, and ready for normal stanzas @@ -628,7 +633,7 @@ function listener.onreadtimeout(conn) local session = sessions[conn]; if session then - return session.sends2s(' '); + return (hosts[session.host] or prosody).events.fire_event("s2s-read-timeout", { session = session }); end end