mod_websocket: Fix read timeout handler (thanks mt)
authorKim Alvefur <zash@zash.se>
Wed, 06 Apr 2016 14:44:51 +0200
changeset 7343 7dea28dafc49
parent 7342 b5565715fce8
child 7344 aa94cd27df4d
child 7345 79a5db780e8b
mod_websocket: Fix read timeout handler (thanks mt)
plugins/mod_websocket.lua
--- a/plugins/mod_websocket.lua	Wed Dec 18 18:11:47 2013 -0500
+++ b/plugins/mod_websocket.lua	Wed Apr 06 14:44:51 2016 +0200
@@ -291,7 +291,10 @@
 end
 
 local function keepalive(event)
-	return conn:write(build_frame({ opcode = 0x9, }));
+	local session = event.session;
+	if session.open_stream == session_open_stream then
+		return session.conn:write(build_frame({ opcode = 0x9, }));
+	end
 end
 
 module:hook("c2s-read-timeout", keepalive, -0.9);