From 8450e7f366ed748f2a758e3bf5ebff6cd9fa8cbd Mon Sep 17 00:00:00 2001 From: zixun Date: Wed, 30 Oct 2019 14:14:28 +0800 Subject: [PATCH] add result of accept --- examples/simplewebsocket.lua | 5 ++++- lualib/http/websocket.lua | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/examples/simplewebsocket.lua b/examples/simplewebsocket.lua index fe46d5bf..99848209 100755 --- a/examples/simplewebsocket.lua +++ b/examples/simplewebsocket.lua @@ -43,7 +43,10 @@ if MODE == "agent" then skynet.start(function () skynet.dispatch("lua", function (_,_, id, protocol, addr) - websocket.accept(id, handle, protocol, addr) + local ok, err = websocket.accept(id, handle, protocol, addr) + if not ok then + print(err) + end end) end) diff --git a/lualib/http/websocket.lua b/lualib/http/websocket.lua index 49947109..bfecdbe6 100755 --- a/lualib/http/websocket.lua +++ b/lualib/http/websocket.lua @@ -407,9 +407,11 @@ function M.accept(socket_id, handle, protocol, addr) try_handle(ws_obj, "error") end else - error(err) + -- error(err) + return false, err end end + return true end