Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
10452:fa11070c2cd7 | 10453:926d6086a95a |
---|---|
21 local websockets = {}; | 21 local websockets = {}; |
22 | 22 |
23 local websocket_listeners = {}; | 23 local websocket_listeners = {}; |
24 function websocket_listeners.ondisconnect(conn, err) | 24 function websocket_listeners.ondisconnect(conn, err) |
25 local s = websockets[conn]; | 25 local s = websockets[conn]; |
26 if not s then return; end | |
26 websockets[conn] = nil; | 27 websockets[conn] = nil; |
27 if s.close_timer then | 28 if s.close_timer then |
28 timer.stop(s.close_timer); | 29 timer.stop(s.close_timer); |
29 s.close_timer = nil; | 30 s.close_timer = nil; |
30 end | 31 end |