net.websocket: Fix traceback in case of ondisconnect being called twice
authorMatthew Wild <mwild1@gmail.com>
Tue, 26 Nov 2019 15:29:01 +0000
changeset 10457 926d6086a95a
parent 10456 fa11070c2cd7
child 10458 6c3fccb75b38
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.
net/websocket.lua
--- 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);