From 8686a0c23434b0d4fda374925dc74b529baa8868 Mon Sep 17 00:00:00 2001 From: Hakan Lindestaf Date: Wed, 29 May 2024 00:44:35 -0500 Subject: [PATCH] Fixed re-init ports --- src/Haukcode.sACN/Haukcode.sACN.csproj | 2 +- src/Haukcode.sACN/SACNClient.cs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Haukcode.sACN/Haukcode.sACN.csproj b/src/Haukcode.sACN/Haukcode.sACN.csproj index 13b5118..7ce5cc4 100644 --- a/src/Haukcode.sACN/Haukcode.sACN.csproj +++ b/src/Haukcode.sACN/Haukcode.sACN.csproj @@ -35,7 +35,7 @@ - + diff --git a/src/Haukcode.sACN/SACNClient.cs b/src/Haukcode.sACN/SACNClient.cs index be19ee0..cbf101c 100644 --- a/src/Haukcode.sACN/SACNClient.cs +++ b/src/Haukcode.sACN/SACNClient.cs @@ -275,10 +275,12 @@ private async Task Sender() { while (!this.shutdownCTS.IsCancellationRequested) { - var sendData = this.sendQueue.Take(this.shutdownCTS.Token); + SendData sendData = null; try { + sendData = this.sendQueue.Take(this.shutdownCTS.Token); + if (sendData.AgeMS > 100) { // Old, discard @@ -316,7 +318,7 @@ private async Task Sender() finally { // Return to pool - sendData.Data.Dispose(); + sendData?.Data?.Dispose(); } } }