Diff

net/websocket.lua @ 10453:926d6086a95a

net.websocket: Fix traceback in case of ondisconnect being called twice We want to figure out what situations the double ondisconnect happens in, and aim to fix the root cause in the future.
author Matthew Wild <mwild1@gmail.com>
date Tue, 26 Nov 2019 15:29:01 +0000
parent 10113:66a9bc2d5c8d
child 12974:ba409c67353b
line wrap: on
line diff
--- a/net/websocket.lua	Tue Nov 26 00:12:51 2019 +0100
+++ b/net/websocket.lua	Tue Nov 26 15:29:01 2019 +0000
@@ -23,6 +23,7 @@
 local websocket_listeners = {};
 function websocket_listeners.ondisconnect(conn, err)
 	local s = websockets[conn];
+	if not s then return; end
 	websockets[conn] = nil;
 	if s.close_timer then
 		timer.stop(s.close_timer);