From 5233e9f1b06cac76668d017c2d2f9d193cbba95e Mon Sep 17 00:00:00 2001 From: Matthew Endsley Date: Wed, 16 Dec 2020 13:30:24 -0800 Subject: [PATCH] Fix disposal issues in ThreadLimitedUdpConnectionListener --- .../ThreadLimitedUdpConnectionListener.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Hazel/FewerThreads/ThreadLimitedUdpConnectionListener.cs b/Hazel/FewerThreads/ThreadLimitedUdpConnectionListener.cs index 3d59106..fca1a8e 100644 --- a/Hazel/FewerThreads/ThreadLimitedUdpConnectionListener.cs +++ b/Hazel/FewerThreads/ThreadLimitedUdpConnectionListener.cs @@ -308,16 +308,19 @@ namespace Hazel.Udp.FewerThreads this.isActive = false; - this.receiveQueue.CompleteAdding(); - this.sendQueue.CompleteAdding(); + this.receiveQueue?.CompleteAdding(); + this.sendQueue?.CompleteAdding(); this.reliablePacketThread.Join(); this.sendThread.Join(); this.receiveThread.Join(); this.processThreads.Join(); - this.receiveQueue.Dispose(); - this.sendQueue.Dispose(); + this.receiveQueue?.Dispose(); + this.receiveQueue = null; + this.sendQueue?.Dispose(); + this.sendQueue = null; + } public void Dispose() -- 2.39.5