From 6e363bab22ca4e4fb558bebd020280f98206c69f Mon Sep 17 00:00:00 2001 From: Starlk Date: Sun, 3 Mar 2024 16:38:32 +0300 Subject: [PATCH] Fix shutdown exceptions (#434) --- Obsidian/Services/PacketBroadcaster.cs | 3 +-- Obsidian/WorldData/WorldManager.cs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Obsidian/Services/PacketBroadcaster.cs b/Obsidian/Services/PacketBroadcaster.cs index 7fe35cc0..dd35faff 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); } @@ -96,7 +96,6 @@ public interface IPacketBroadcaster /// The list of entity ids to exlude from the broadcast. public void Broadcast(IClientboundPacket packet, params int[] excludedIds); - /// /// Sends the packets directly to connected clients without processing in a queue. /// diff --git a/Obsidian/WorldData/WorldManager.cs b/Obsidian/WorldData/WorldManager.cs index 58150ed3..0cc80e00 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); }