mod_websocket: Fix read timeout handler (thanks mt)
authorKim Alvefur <zash@zash.se>
Wed, 6 Apr 2016 12:44:51 +0000 (14:44 +0200)
committerKim Alvefur <zash@zash.se>
Wed, 6 Apr 2016 12:44:51 +0000 (14:44 +0200)
plugins/mod_websocket.lua

index 086eab62603bde1de809829bdbc0bf493559d340..a3f5318c9b54636f8caec1b747bf39fd56bd9033 100644 (file)
@@ -291,7 +291,10 @@ function handle_request(event)
 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);