Add client id logs

This commit is contained in:
Sanae 2022-02-09 15:48:05 -06:00
parent b660fcfd53
commit 94a29aca12
1 changed files with 3 additions and 3 deletions

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));
} }