0
0
Fork 0
mirror of https://github.com/Sanae6/SmoOnlineServer.git synced 2024-11-29 06:33:06 +00:00

Add client id logs

This commit is contained in:
Sanae 2022-02-09 15:48:05 -06:00
parent b660fcfd53
commit 94a29aca12

View file

@ -134,7 +134,7 @@ public class Server {
} }
} }
Logger.Info($"Client {socket.RemoteEndPoint} connected."); Logger.Info($"Client {socket.RemoteEndPoint} ({client.Id}) connected.");
} }
@ -145,9 +145,9 @@ public class Server {
} }
catch (Exception e) { catch (Exception e) {
if (e is SocketException {SocketErrorCode: SocketError.ConnectionReset}) { if (e is SocketException {SocketErrorCode: SocketError.ConnectionReset}) {
Logger.Info($"Client {socket.RemoteEndPoint} disconnected from the server"); Logger.Info($"Client {socket.RemoteEndPoint} ({client.Id}) disconnected from the server");
} else { } else {
Logger.Error($"Exception on socket {socket.RemoteEndPoint}, disconnecting for: {e}"); Logger.Error($"Exception on socket {socket.RemoteEndPoint} ({client.Id}) and disconnecting for: {e}");
Task.Run(() => socket.DisconnectAsync(false)); Task.Run(() => socket.DisconnectAsync(false));
} }