diff --git a/Pokemon.3D.Server.Core/Pokemon.3D.Server.Core.csproj b/Pokemon.3D.Server.Core/Pokemon.3D.Server.Core.csproj
index 17ca06b..5e7c3ac 100644
--- a/Pokemon.3D.Server.Core/Pokemon.3D.Server.Core.csproj
+++ b/Pokemon.3D.Server.Core/Pokemon.3D.Server.Core.csproj
@@ -85,7 +85,7 @@
-
+
diff --git a/Pokemon.3D.Server.Core/SCON_Client_Listener/SCON/SCONClient.cs b/Pokemon.3D.Server.Core/SCON_Client_Listener/SCON/SCONClient.cs
index 78bed58..69ae4f3 100644
--- a/Pokemon.3D.Server.Core/SCON_Client_Listener/SCON/SCONClient.cs
+++ b/Pokemon.3D.Server.Core/SCON_Client_Listener/SCON/SCONClient.cs
@@ -48,7 +48,7 @@ public partial class SCONClient
public SCONClient(ITCPClient clientWrapper, ModuleSCON server)
{
Stream = new ProtobufStream(clientWrapper);
- Module = (ModuleSCON) server;
+ Module = server;
AuthorizationStatus = (EncryptionEnabled ? AuthorizationStatus.EncryprionEnabled : 0);
}
@@ -69,8 +69,7 @@ public void Update()
else
{
Core.Logger.Log($"Protobuf Reading Error: Packet Length size is 0. Disconnecting.");
- SendPacket(new AuthorizationDisconnectPacket { Reason = "Packet Length size is 0!" });
- Module.RemoveClient(this);
+ Module.RemoveClient(this, "Packet Length size is 0!");
}
}
}
@@ -108,8 +107,7 @@ private void HandleData(byte[] data)
else
{
Core.Logger.Log($"SCON Reading Error: Packet ID {id} is not correct, Packet Data: {data}. Disconnecting.");
- SendPacket(new AuthorizationDisconnectPacket { Reason = $"Packet ID {id} is not correct!" });
- Module.RemoveClient(this);
+ Module.RemoveClient(this, $"Packet ID {id} is not correct!");
}
}
}
diff --git a/Pokemon.3D.Server.Core/SCON_Client_Listener/Servers/Listener.cs b/Pokemon.3D.Server.Core/SCON_Client_Listener/Servers/ModuleSCON.cs
similarity index 89%
rename from Pokemon.3D.Server.Core/SCON_Client_Listener/Servers/Listener.cs
rename to Pokemon.3D.Server.Core/SCON_Client_Listener/Servers/ModuleSCON.cs
index 16a0e7f..942fa3a 100644
--- a/Pokemon.3D.Server.Core/SCON_Client_Listener/Servers/Listener.cs
+++ b/Pokemon.3D.Server.Core/SCON_Client_Listener/Servers/ModuleSCON.cs
@@ -3,7 +3,7 @@
using System.Threading;
using Aragas.Core.Wrappers;
-
+using PokeD.Core.Packets.SCON.Authorization;
using Pokemon_3D_Server_Core.SCON_Client_Listener.SCON;
using Pokemon_3D_Server_Core.Server_Client_Listener.Loggers;
using Pokemon_3D_Server_Core.Shared.jianmingyong.Modules;
@@ -69,7 +69,16 @@ private void CheckListener()
public void AddClient(SCONClient client) { Clients.Add(client); }
- public void RemoveClient(SCONClient client, string reason = "") { Clients.Remove(client); }
+
+ public void RemoveClient(SCONClient client, string reason = "")
+ {
+ Clients.Remove(client);
+
+ if(!string.IsNullOrEmpty(reason))
+ client.SendPacket(new AuthorizationDisconnectPacket { Reason = reason });
+
+ client.Dispose();
+ }
private void Update()
@@ -99,7 +108,7 @@ public void Dispose()
Clients.Clear();
- Core.Logger.Log("SCON Listener Disposed.", Logger.LogTypes.Info);
+ Core.Logger.Log("SCON Listener Disposed.");
}
}
}
\ No newline at end of file