mirror of
https://github.com/Sanae6/SmoOnlineServer.git
synced 2024-11-28 06:03:05 +00:00
only broadcast the DisconnectPacket, if the client was connected
This commit is contained in:
parent
c81f6aaf96
commit
4b04a3d5be
1 changed files with 5 additions and 2 deletions
|
@ -299,6 +299,7 @@ public class Server {
|
|||
}
|
||||
|
||||
close:
|
||||
bool wasConnected = client.Connected;
|
||||
// Clients.Remove(client)
|
||||
client.Connected = false;
|
||||
try {
|
||||
|
@ -307,8 +308,10 @@ public class Server {
|
|||
catch { /*lol*/ }
|
||||
|
||||
#pragma warning disable CS4014
|
||||
if (wasConnected) {
|
||||
Task.Run(() => Broadcast(new DisconnectPacket(), client))
|
||||
.ContinueWith(x => { if (x.Exception != null) { Logger.Error(x.Exception.ToString()); } });
|
||||
}
|
||||
#pragma warning restore CS4014
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue