修改ws的ping间隔和自我认定掉线时间
This commit is contained in:
@@ -243,7 +243,7 @@ function WS.connect(name,subPath,body)
|
|||||||
readCHN=love.thread.newChannel(),
|
readCHN=love.thread.newChannel(),
|
||||||
lastPingTime=0,
|
lastPingTime=0,
|
||||||
lastPongTime=timer(),
|
lastPongTime=timer(),
|
||||||
pingInterval=26,
|
pingInterval=12,
|
||||||
status='connecting',--connecting, running, dead
|
status='connecting',--connecting, running, dead
|
||||||
sendTimer=0,
|
sendTimer=0,
|
||||||
alertTimer=0,
|
alertTimer=0,
|
||||||
@@ -269,7 +269,7 @@ end
|
|||||||
|
|
||||||
function WS.setPingInterval(name,time)
|
function WS.setPingInterval(name,time)
|
||||||
local ws=wsList[name]
|
local ws=wsList[name]
|
||||||
ws.pingInterval=math.max(time or 1,2.6)
|
ws.pingInterval=math.max(time or 2.6,2.6)
|
||||||
end
|
end
|
||||||
|
|
||||||
function WS.alert(name)
|
function WS.alert(name)
|
||||||
@@ -348,7 +348,7 @@ function WS.update(dt)
|
|||||||
ws.sendCHN:push("")--ping
|
ws.sendCHN:push("")--ping
|
||||||
ws.lastPingTime=time
|
ws.lastPingTime=time
|
||||||
end
|
end
|
||||||
if time-ws.lastPongTime>10+3*ws.pingInterval then
|
if time-ws.lastPongTime>6+2*ws.pingInterval then
|
||||||
WS.close(name)
|
WS.close(name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ return STRING.split([=[
|
|||||||
取消软件锁功能
|
取消软件锁功能
|
||||||
简化击杀标记
|
简化击杀标记
|
||||||
控制台支持滚轮和键盘导航
|
控制台支持滚轮和键盘导航
|
||||||
|
缩短联网ping间隔和自我认定掉线时间
|
||||||
代码:
|
代码:
|
||||||
场景模块支持拖拽文件(夹)事件
|
场景模块支持拖拽文件(夹)事件
|
||||||
允许模式给每个玩家初始化多个任务
|
允许模式给每个玩家初始化多个任务
|
||||||
|
|||||||
Reference in New Issue
Block a user