Changeset

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
parents 10452:fa11070c2cd7
children 10454:6c3fccb75b38
files net/websocket.lua
diffstat 1 files changed, 1 insertions(+), 0 deletions(-) [+]
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);