Diff

plugins/mod_c2s.lua @ 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
parent 5571:ae9672f4079a
child 5668:5a9318ac92f6
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