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