From a3ff9dacc8de0687c8bce1e41fe68cab347db90b Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Sat, 27 Mar 2021 21:11:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=B8=AA=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/websocket.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Zframework/websocket.lua b/Zframework/websocket.lua index 79e0d378..4273fdf5 100644 --- a/Zframework/websocket.lua +++ b/Zframework/websocket.lua @@ -77,16 +77,16 @@ do--Connect code=l:find(" "); code=l:sub(code+1,code+3) end + local ctLen + repeat + l=SOCK:receive("*l") + if not ctLen and l:find"Length"then + ctLen=tonumber(l:match"%d+") + end + until l=="" if code=="101"then readCHN:push("success") else - local ctLen - repeat - l=SOCK:receive("*l") - if not ctLen and l:find"Length"then - ctLen=tonumber(l:match"%d+") - end - until l=="" local reason=JSON.decode(SOCK:receive(ctLen)) readCHN:push(code..":"..(reason and reason.message or"Server Error")) end