From 895873c51e767ac832899aa6933f0695a00f86f9 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 28 Oct 2020 08:58:07 -0600 Subject: [PATCH] add StopDebugTimer method --- .../Comm/CommunicationStreamDebugging.cs | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/Pepperdash Core/Pepperdash Core/Comm/CommunicationStreamDebugging.cs b/Pepperdash Core/Pepperdash Core/Comm/CommunicationStreamDebugging.cs index 4248203..b5b1c15 100644 --- a/Pepperdash Core/Pepperdash Core/Comm/CommunicationStreamDebugging.cs +++ b/Pepperdash Core/Pepperdash Core/Comm/CommunicationStreamDebugging.cs @@ -79,15 +79,7 @@ namespace PepperDash.Core _DebugTimeoutInMs = minutes * 60000; - if (DebugExpiryPeriod != null) - { - DebugExpiryPeriod.Stop(); - DebugExpiryPeriod.Dispose(); - DebugExpiryPeriod = null; - } - - RxStreamDebuggingIsEnabled = false; - TxStreamDebuggingIsEnabled = false; + StopDebugTimer(); DebugExpiryPeriod = new CTimer((o) => DisableDebugging(), _DebugTimeoutInMs); @@ -106,17 +98,24 @@ namespace PepperDash.Core /// private void DisableDebugging() { - if (DebugExpiryPeriod != null) - { - DebugExpiryPeriod.Stop(); - DebugExpiryPeriod.Dispose(); - DebugExpiryPeriod = null; - } + StopDebugTimer(); + Debug.SetDeviceDebugSettings(ParentDeviceKey, eStreamDebuggingSetting.Off); + } + + private void StopDebugTimer() + { RxStreamDebuggingIsEnabled = false; TxStreamDebuggingIsEnabled = false; - Debug.SetDeviceDebugSettings(ParentDeviceKey, eStreamDebuggingSetting.Off); + if (DebugExpiryPeriod == null) + { + return; + } + + DebugExpiryPeriod.Stop(); + DebugExpiryPeriod.Dispose(); + DebugExpiryPeriod = null; } }