aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2013-05-30 14:32:40 +0200
committerKim Alvefur <zash@zash.se>2013-05-30 14:32:40 +0200
commit953b24c0ca0d5245a54828d4ce4619262f0e80a7 (patch)
treedc6a45f79ff62be44b304e112ee80f9f9d017997 /plugins
parent6902706cc19dae4234486a9780c2ec5b23d950aa (diff)
downloadprosody-953b24c0ca0d5245a54828d4ce4619262f0e80a7.tar.gz
prosody-953b24c0ca0d5245a54828d4ce4619262f0e80a7.zip
mod_c2s, mod_c2s: Send a whitespace on read timeout, to prod TCP into detecting if the connection died
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_c2s.lua7
-rw-r--r--plugins/mod_s2s/mod_s2s.lua7
2 files changed, 14 insertions, 0 deletions
diff --git a/plugins/mod_c2s.lua b/plugins/mod_c2s.lua
index 1d2dd6dd..f9a270c7 100644
--- a/plugins/mod_c2s.lua
+++ b/plugins/mod_c2s.lua
@@ -262,6 +262,13 @@ function listener.ondisconnect(conn, err)
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
diff --git a/plugins/mod_s2s/mod_s2s.lua b/plugins/mod_s2s/mod_s2s.lua
index ab5b7232..309940cf 100644
--- a/plugins/mod_s2s/mod_s2s.lua
+++ b/plugins/mod_s2s/mod_s2s.lua
@@ -624,6 +624,13 @@ function listener.ondisconnect(conn, err)
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;