From 21d680d5b776464f1426ae3333bfbc2870a7c397 Mon Sep 17 00:00:00 2001 From: zixun Date: Wed, 31 Jul 2019 14:23:23 +0800 Subject: [PATCH] triger handle close when force close --- lualib/http/websocket.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lualib/http/websocket.lua b/lualib/http/websocket.lua index 0aef92cc..50dd6c68 100755 --- a/lualib/http/websocket.lua +++ b/lualib/http/websocket.lua @@ -254,6 +254,7 @@ local function resolve_accept(self) local recv_buf = {} while true do if _isws_closed(self.id) then + try_handle(self, "close") return end local fin, op, payload_data = read_frame(self) @@ -398,7 +399,9 @@ function M.accept(socket_id, handle, protocol) end if not ok then if err == socket_error then - if not closed then + if closed then + try_handle(ws_obj, "close") + else try_handle(ws_obj, "error") end else