Skip to content

Commit

Permalink
Catch exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
TheVeryStarlk committed Mar 3, 2024
1 parent d3a2867 commit 9ff760f
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions Obsidian/Server.cs
Original file line number Diff line number Diff line change
Expand Up @@ -394,13 +394,19 @@ async Task ExecuteAsync(Client client)
{
// Ignore.
}
catch (Exception exception)
{
_logger.LogError("Unexpected exception from client {Identifier}: {Message}", client.id, exception.Message);
}
finally
{
_clients.TryRemove(client);

_clients.TryRemove(client);

if (client.Player is not null)
_ = OnlinePlayers.TryRemove(client.Player.Uuid, out _);
if (client.Player is not null)
_ = OnlinePlayers.TryRemove(client.Player.Uuid, out _);

client.Dispose();
client.Dispose();
}
}
}

Expand Down

0 comments on commit 9ff760f

Please sign in to comment.