diff options
author | Kim Alvefur <zash@zash.se> | 2013-06-11 21:36:15 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2013-06-11 21:36:15 +0200 |
commit | 707befd0eaee86e6d80d7b0b539abf78f2fd23a5 (patch) | |
tree | b32edde961413150280e7ba6efa7492ae42b60bc /plugins/mod_c2s.lua | |
parent | 6af157e1f8bafe7dec7adf3b0834314fd79d0b39 (diff) | |
download | prosody-707befd0eaee86e6d80d7b0b539abf78f2fd23a5.tar.gz prosody-707befd0eaee86e6d80d7b0b539abf78f2fd23a5.zip |
mod_c2s, mod_s2s: Fire an event on read timeouts
Diffstat (limited to 'plugins/mod_c2s.lua')
-rw-r--r-- | plugins/mod_c2s.lua | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/plugins/mod_c2s.lua b/plugins/mod_c2s.lua index d87b3415..91bde574 100644 --- a/plugins/mod_c2s.lua +++ b/plugins/mod_c2s.lua @@ -265,15 +265,23 @@ end function listener.onreadtimeout(conn) local session = sessions[conn]; if session then - return session.send(' '); + return (hosts[session.host] or prosody).events.fire_event("c2s-read-timeout", { session = session }); end end +local function keepalive(event) + return event.session.send(' '); +end + function listener.associate_session(conn, session) sessions[conn] = session; end -function module.add_host() end +function module.add_host(module) + module:hook("c2s-read-timeout", keepalive, -1); +end + +module:hook("c2s-read-timeout", keepalive, -1); module:hook("server-stopping", function(event) local reason = event.reason; |