Software /
code /
prosody
Changeset
5638:c5b7f4858014
mod_c2s, mod_c2s: Send a whitespace on read timeout, to prod TCP into detecting if the connection died
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 30 May 2013 14:32:40 +0200 |
parents | 5637:991b47778bf3 |
children | 5640:4f1889672063 |
files | plugins/mod_c2s.lua plugins/mod_s2s/mod_s2s.lua |
diffstat | 2 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_c2s.lua Tue May 28 18:32:51 2013 +0200 +++ b/plugins/mod_c2s.lua Thu May 30 14:32:40 2013 +0200 @@ -262,6 +262,13 @@ end end +function listener.onreadtimeout(conn) + local session = sessions[conn]; + if session then + return session.send(' '); + end +end + function listener.associate_session(conn, session) sessions[conn] = session; end
--- a/plugins/mod_s2s/mod_s2s.lua Tue May 28 18:32:51 2013 +0200 +++ b/plugins/mod_s2s/mod_s2s.lua Thu May 30 14:32:40 2013 +0200 @@ -624,6 +624,13 @@ end end +function listener.onreadtimeout(conn) + local session = sessions[conn]; + if session then + return session.sends2s(' '); + end +end + function listener.register_outgoing(conn, session) session.direction = "outgoing"; sessions[conn] = session;