Skip to content

Commit

Permalink
协议库抛异常时不断开客户端连接
Browse files Browse the repository at this point in the history
  • Loading branch information
Megghy committed Jan 11, 2022
1 parent 445ca82 commit 3bf9460
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions MultiSEngine/Core/Adapter/BaseAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ protected virtual void OnRecieveLoopError(Exception ex)
case EndOfStreamException:
case IOException:
case BadBoundException:
//
break;
default:
Logs.Warn($"{(ListenningClient ? "Client" : "Server")} recieve loop abnormally terminated.\r\n{ex}");
Expand Down
4 changes: 3 additions & 1 deletion MultiSEngine/Core/Adapter/ClientAdapter.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using MultiSEngine.DataStruct;
using MultiSEngine.Modules;
using System;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Sockets;
Expand All @@ -19,7 +20,8 @@ public ClientAdapter(ClientData client, Socket connection) : base(client, connec
protected override void OnRecieveLoopError(Exception ex)
{
base.OnRecieveLoopError(ex);
Client.Disconnect();
if(ex.Source != "TrProtocol")
Client.Disconnect();
}
public override bool ListenningClient => true;
public override bool GetPacket(Packet packet)
Expand Down
2 changes: 0 additions & 2 deletions MultiSEngine/Core/Adapter/FakeWorldAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ public override bool GetPacket(Packet packet)
if (Client.Player.VersionNum != Config.Instance.ServerVersion && !Config.Instance.EnableCrossplayFeature)
Client.Disconnect(Localization.Instance["Prompt_VersionNotAllowed", Modules.Data.Convert(Client.Player.VersionNum)]);
else
{
InternalSendPacket(new LoadPlayer() { PlayerSlot = 0, ServerWantsToRunCheckBytesInClientLoopThread = true });
}
}
return false;
case RequestWorldInfo:
Expand Down

0 comments on commit 3bf9460

Please sign in to comment.