From b3a003352ee70c7f4c43d455c48bcdbeaf2e0979 Mon Sep 17 00:00:00 2001 From: Jason T Alborough Date: Thu, 25 Apr 2019 08:32:46 -0400 Subject: [PATCH] # PDC-5 AddQueueToGenericUdpServer - Removed the Finally statement. Using finally caused a null refence exception for the CCriticalSection object at shutdown. --- .../Pepperdash Core/Comm/GenericUdpServer.cs | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Pepperdash Core/Pepperdash Core/Comm/GenericUdpServer.cs b/Pepperdash Core/Pepperdash Core/Comm/GenericUdpServer.cs index 5b1bf3f..f819c17 100644 --- a/Pepperdash Core/Pepperdash Core/Comm/GenericUdpServer.cs +++ b/Pepperdash Core/Pepperdash Core/Comm/GenericUdpServer.cs @@ -222,24 +222,24 @@ namespace PepperDash.Core { try { - while (true) - { - // Pull from Queue and fire an event. Block indefinitely until an item can be removed, similar to a Gather. - var message = MessageQueue.Dequeue(); - var dataRecivedExtra = DataRecievedExtra; - if (dataRecivedExtra != null) - { - dataRecivedExtra(this, message); - } - } - } + while (true) + { + // Pull from Queue and fire an event. Block indefinitely until an item can be removed, similar to a Gather. + var message = MessageQueue.Dequeue(); + var dataRecivedExtra = DataRecievedExtra; + if (dataRecivedExtra != null) + { + dataRecivedExtra(this, message); + } + } + } catch (Exception e) { Debug.Console(0, "GenericUdpServer DequeueEvent error: {0}\r", e); } - finally + // Make sure to leave the CCritical section in case an exception above stops this thread, or we won't be able to restart it. + if (DequeueLock != null) { - // Make sure to leave the CCritical section in case an exception above stops this thread, or we won't be able to restart it. DequeueLock.Leave(); } }