整理代码

This commit is contained in:
MrZ626
2021-04-13 21:05:07 +08:00
parent cc9cf92b27
commit 321d6554e7

View File

@@ -241,7 +241,7 @@ end
--WS tick funcs --WS tick funcs
function NET.updateWS_app() function NET.updateWS_app()
local retryTime=5 local retryTime=3
while true do while true do
YIELD() YIELD()
local status=WS.status("app") local status=WS.status("app")
@@ -286,7 +286,7 @@ function NET.updateWS_app()
elseif status=="dead"then elseif status=="dead"then
retryTime=retryTime-1 retryTime=retryTime-1
if retryTime==0 then return end if retryTime==0 then return end
for _=1,120 do YIELD()end for _=1,180 do YIELD()end
WS.connect("app","/app") WS.connect("app","/app")
end end
end end
@@ -294,8 +294,7 @@ end
function NET.updateWS_user() function NET.updateWS_user()
while true do while true do
YIELD() YIELD()
local status=WS.status("user") if WS.status("user")=="running"then
if status=="running"then
local message,op=WS.read("user") local message,op=WS.read("user")
if message then if message then
if op=="ping"then if op=="ping"then
@@ -312,7 +311,7 @@ function NET.updateWS_user()
USER.uid=res.uid USER.uid=res.uid
USER.authToken=res.authToken USER.authToken=res.authToken
FILE.save(USER,"conf/user","q") FILE.save(USER,"conf/user","q")
SCN.back() if SCN.cur=="login"then SCN.back()end
end end
LOG.print(text.loginSuccessed) LOG.print(text.loginSuccessed)
@@ -337,8 +336,7 @@ end
function NET.updateWS_play() function NET.updateWS_play()
while true do while true do
YIELD() YIELD()
local status=WS.status("play") if WS.status("play")=="running"then
if status=="running"then
local message,op=WS.read("play") local message,op=WS.read("play")
if message then if message then
if op=="ping"then if op=="ping"then
@@ -468,8 +466,7 @@ end
function NET.updateWS_stream() function NET.updateWS_stream()
while true do while true do
YIELD() YIELD()
local status=WS.status("stream") if WS.status("stream")=="running"then
if status=="running"then
local message,op=WS.read("stream") local message,op=WS.read("stream")
if message then if message then
if op=="ping"then if op=="ping"then
@@ -514,8 +511,7 @@ end
function NET.updateWS_chat() function NET.updateWS_chat()
while true do while true do
YIELD() YIELD()
local status=WS.status("chat") if WS.status("chat")=="running"then
if status=="running"then
local message,op=WS.read("chat") local message,op=WS.read("chat")
if message then if message then
if op=="ping"then if op=="ping"then