From f45963215a6fa782c03e8306bb2a0f645444360b Mon Sep 17 00:00:00 2001 From: "starlkytminecraft@gmail.com" Date: Mon, 26 Feb 2024 00:54:58 +0300 Subject: [PATCH] Ignore operation cancelled exception in try/catch. Fixes #430 --- Obsidian/Services/PacketBroadcaster.cs | 2 +- Obsidian/WorldData/WorldManager.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Obsidian/Services/PacketBroadcaster.cs b/Obsidian/Services/PacketBroadcaster.cs index 7fe35cc0..331f9ec1 100644 --- a/Obsidian/Services/PacketBroadcaster.cs +++ b/Obsidian/Services/PacketBroadcaster.cs @@ -71,7 +71,7 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken) await player.client.QueuePacketAsync(queuedPacket.Packet); } } - catch (Exception e) + catch (Exception e) when (e is not OperationCanceledException) { await this.environment.OnServerCrashAsync(this.logger, e); } diff --git a/Obsidian/WorldData/WorldManager.cs b/Obsidian/WorldData/WorldManager.cs index 58150ed3..0c97a596 100644 --- a/Obsidian/WorldData/WorldManager.cs +++ b/Obsidian/WorldData/WorldManager.cs @@ -57,7 +57,7 @@ protected async override Task ExecuteAsync(CancellationToken stoppingToken) await Task.WhenAll(this.worlds.Values.Cast().Select(x => x.ManageChunksAsync())); } } - catch (Exception ex) + catch (Exception ex) when (ex is not OperationCanceledException) { await this.serverEnvironment.OnServerCrashAsync(this.logger, ex); }