1
This commit is contained in:
@@ -8,7 +8,7 @@ namespace BITKit
|
||||
{
|
||||
public static class BIT4Log
|
||||
{
|
||||
#if UNITY_EDITOR && UNITY_64
|
||||
#if UNITY_EDITOR && UNITY_5_3_OR_NEWER
|
||||
[RuntimeInitializeOnLoadMethod]
|
||||
private static void Reload()
|
||||
{
|
||||
|
@@ -242,7 +242,7 @@ namespace BITKit.Net
|
||||
else
|
||||
{
|
||||
returnWriter.Write(false);
|
||||
returnWriter.Write("未找到对应的Rpc方法");
|
||||
returnWriter.Write($"未找到对应的Rpc方法:{path}");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@@ -66,6 +66,10 @@ namespace BITKit.Net
|
||||
if (server.IsActive() is false || ManualTick) return;
|
||||
server.Tick();
|
||||
}
|
||||
catch (SocketException)
|
||||
{
|
||||
//丢失链接,有用户断开连接,通常是正常现象
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
BIT4Log.LogException(exception);
|
||||
@@ -254,7 +258,7 @@ namespace BITKit.Net
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("未找到对应的Rpc方法");
|
||||
throw new Exception($"未找到对应的Rpc方法:{path}");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -262,7 +266,8 @@ namespace BITKit.Net
|
||||
{
|
||||
var commandObj = BITBinary.Read(reader)
|
||||
.As<object[]>()[0];
|
||||
if (_rpc.TryGetValue(commandObj.GetType()!.FullName!, out var func))
|
||||
var funcName = commandObj.GetType()!.FullName!;
|
||||
if (_rpc.TryGetValue(funcName, out var func))
|
||||
{
|
||||
var value = await func.As<Func<object, UniTask<object>>>().Invoke(commandObj);
|
||||
returnWriter.Write(true);
|
||||
@@ -270,7 +275,7 @@ namespace BITKit.Net
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("未找到对应的Rpc方法");
|
||||
throw new Exception($"未找到对应的Rpc方法:{funcName}");
|
||||
}
|
||||
}
|
||||
{
|
||||
@@ -471,7 +476,10 @@ namespace BITKit.Net
|
||||
.Write((byte)commandType)
|
||||
.WriteObject(values)
|
||||
.Build();
|
||||
server.Send(id,bytes, KcpChannel.Reliable);
|
||||
if (server.connections.ContainsKey(id))
|
||||
{
|
||||
server.Send(id,bytes, KcpChannel.Reliable);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -166,6 +166,8 @@ namespace kcp2k
|
||||
// the other end closing the connection is not an 'error'.
|
||||
// but connections should never just end silently.
|
||||
// at least log a message for easier debugging.
|
||||
|
||||
//sure I go next somewhere record it
|
||||
Log.Info($"KcpServer: ReceiveFrom failed: {e}");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user