This commit is contained in:
CortexCore
2024-07-27 14:55:18 +08:00
parent ed4ef12f22
commit 0cd23abbc5
5 changed files with 25 additions and 16 deletions

View File

@@ -463,9 +463,9 @@ namespace BITKit.Net
while (true)
{
if ((_now - startTime).TotalSeconds > 5 || IsConnected is false)
if ((_now - startTime).TotalSeconds > 5)
{
//await BITApp.SwitchToMainThread();
await BITApp.SwitchToMainThread();
if (string.IsNullOrEmpty(path))
{
throw new TimeoutException("请求超时或已断开连接");

View File

@@ -80,7 +80,7 @@ namespace BITKit.Net
{
server.Send(id,_heartBeat , KcpChannel.Unreliable);
if (!_lastHeartbeat.TryGetValue(id, out var time)) continue;
if (!((_now - time).TotalSeconds > 1)) continue;
if (!((_now - time).TotalSeconds > 3)) continue;
server.Disconnect(id);
_lastHeartbeat.TryRemove(id);
BIT4Log.Log<KCPNetServer>($"{Name}:链接{id}超时,已断开");