From 145682efc49d48da4a7696f52834cb4256f4df1b Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 21 Sep 2020 09:21:03 -0600 Subject: [PATCH 01/10] Try and fix null ref exception for XSigSerialToken --- .../Pepperdash Core/XSigUtility/Tokens/XSigSerialToken.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Pepperdash Core/Pepperdash Core/XSigUtility/Tokens/XSigSerialToken.cs b/Pepperdash Core/Pepperdash Core/XSigUtility/Tokens/XSigSerialToken.cs index 845b297..cc61b1f 100644 --- a/Pepperdash Core/Pepperdash Core/XSigUtility/Tokens/XSigSerialToken.cs +++ b/Pepperdash Core/Pepperdash Core/XSigUtility/Tokens/XSigSerialToken.cs @@ -29,7 +29,8 @@ namespace PepperDash.Core.Intersystem.Tokens public override byte[] GetBytes() { - var serialBytes = Encoding.GetEncoding(28591).GetBytes(Value); + var serialBytes = String.IsNullOrEmpty(Value) ? new byte[0] : Encoding.GetEncoding(28591).GetBytes(Value); + var xsig = new byte[serialBytes.Length + 3]; xsig[0] = (byte)(0xC8 | (Index >> 7)); xsig[1] = (byte)((Index - 1) & 0x7F); From 3d7bc32b8a71ec6d92411962272e5d4b68ccf4ed Mon Sep 17 00:00:00 2001 From: Alex Johnson Date: Thu, 15 Oct 2020 16:30:54 -0400 Subject: [PATCH 02/10] Fixes some exceptions when setting stream debugging mode. Changes stream debugging to clear both rx and tx flags before setting mode again. --- .../Comm/CommunicationStreamDebugging.cs | 20 +++++++++++++------ .../Pepperdash Core/Logging/DebugMemory.cs | 6 ++---- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Pepperdash Core/Pepperdash Core/Comm/CommunicationStreamDebugging.cs b/Pepperdash Core/Pepperdash Core/Comm/CommunicationStreamDebugging.cs index f3b5613..1e9603e 100644 --- a/Pepperdash Core/Pepperdash Core/Comm/CommunicationStreamDebugging.cs +++ b/Pepperdash Core/Pepperdash Core/Comm/CommunicationStreamDebugging.cs @@ -81,9 +81,14 @@ namespace PepperDash.Core if (DebugExpiryPeriod != null) { - DisableDebugging(); + DebugExpiryPeriod.Stop(); + DebugExpiryPeriod.Dispose(); + DebugExpiryPeriod = null; } + RxStreamDebuggingIsEnabled = false; + TxStreamDebuggingIsEnabled = false; + DebugExpiryPeriod = new CTimer((o) => DisableDebugging(), _DebugTimeoutInMs); if ((setting & eStreamDebuggingSetting.Rx) == eStreamDebuggingSetting.Rx) @@ -92,7 +97,7 @@ namespace PepperDash.Core if ((setting & eStreamDebuggingSetting.Tx) == eStreamDebuggingSetting.Tx) TxStreamDebuggingIsEnabled = true; - Debug.SetDeviceDebugSettings(ParentDeviceKey, setting); + Debug.SetDeviceDebugSettings(ParentDeviceKey, setting.ToString()); } @@ -101,14 +106,17 @@ namespace PepperDash.Core /// private void DisableDebugging() { - DebugExpiryPeriod.Stop(); - DebugExpiryPeriod.Dispose(); - DebugExpiryPeriod = null; + if (DebugExpiryPeriod != null) + { + DebugExpiryPeriod.Stop(); + DebugExpiryPeriod.Dispose(); + DebugExpiryPeriod = null; + } RxStreamDebuggingIsEnabled = false; TxStreamDebuggingIsEnabled = false; - Debug.SetDeviceDebugSettings(ParentDeviceKey, eStreamDebuggingSetting.Off); + Debug.SetDeviceDebugSettings(ParentDeviceKey, eStreamDebuggingSetting.Off.ToString()); } } diff --git a/Pepperdash Core/Pepperdash Core/Logging/DebugMemory.cs b/Pepperdash Core/Pepperdash Core/Logging/DebugMemory.cs index 1b0fea1..5162853 100644 --- a/Pepperdash Core/Pepperdash Core/Logging/DebugMemory.cs +++ b/Pepperdash Core/Pepperdash Core/Logging/DebugMemory.cs @@ -68,11 +68,9 @@ namespace PepperDash.Core.DebugThings /// public void SetDebugSettingsForKey(string deviceKey, object settings) { - var existingSettings = DeviceDebugSettings[deviceKey]; - - if (existingSettings != null) + if(DeviceDebugSettings.ContainsKey(deviceKey)) { - existingSettings = settings; + DeviceDebugSettings[deviceKey] = settings; } else DeviceDebugSettings.Add(deviceKey, settings); From c253007def2e1136680ddcf91ce5ff4bb4a1dbf0 Mon Sep 17 00:00:00 2001 From: Alex Johnson Date: Thu, 15 Oct 2020 16:52:24 -0400 Subject: [PATCH 03/10] Update CommunicationStreamDebugging.cs Removed unneeded change to convert item to string. --- .../Pepperdash Core/Comm/CommunicationStreamDebugging.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Pepperdash Core/Pepperdash Core/Comm/CommunicationStreamDebugging.cs b/Pepperdash Core/Pepperdash Core/Comm/CommunicationStreamDebugging.cs index 1e9603e..4248203 100644 --- a/Pepperdash Core/Pepperdash Core/Comm/CommunicationStreamDebugging.cs +++ b/Pepperdash Core/Pepperdash Core/Comm/CommunicationStreamDebugging.cs @@ -97,7 +97,7 @@ namespace PepperDash.Core if ((setting & eStreamDebuggingSetting.Tx) == eStreamDebuggingSetting.Tx) TxStreamDebuggingIsEnabled = true; - Debug.SetDeviceDebugSettings(ParentDeviceKey, setting.ToString()); + Debug.SetDeviceDebugSettings(ParentDeviceKey, setting); } @@ -116,7 +116,7 @@ namespace PepperDash.Core RxStreamDebuggingIsEnabled = false; TxStreamDebuggingIsEnabled = false; - Debug.SetDeviceDebugSettings(ParentDeviceKey, eStreamDebuggingSetting.Off.ToString()); + Debug.SetDeviceDebugSettings(ParentDeviceKey, eStreamDebuggingSetting.Off); } } @@ -131,4 +131,4 @@ namespace PepperDash.Core Tx = 2, Both = Rx | Tx } -} \ No newline at end of file +} From 895873c51e767ac832899aa6933f0695a00f86f9 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 28 Oct 2020 08:58:07 -0600 Subject: [PATCH 04/10] 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; } } From 0add9f7552c91f6c535f9dab3b5d685e5e99933e Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 28 Oct 2020 12:47:08 -0600 Subject: [PATCH 05/10] first attempt at using the new env mechanism --- .github/workflows/docker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 17fcebf..d77816a 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -44,7 +44,7 @@ jobs: shell: powershell run: | $version = ./.github/scripts/GenerateVersionNumber.ps1 - Write-Output "::set-env name=VERSION::$version" + echo "VERSION=$version" | Out-File -FilePath $env::GITHUB_ENV -Encoding utf8 -Append # Use the version number to set the version of the assemblies - name: Update AssemblyInfo.cs shell: powershell @@ -123,7 +123,7 @@ jobs: Get-ChildItem "./Version" $version = Get-Content -Path ./Version/version.txt Write-Host "Version: $version" - Write-Output "::set-env name=VERSION::$version" + echo "VERSION=$version" | Out-File -FilePath $env::GITHUB_ENV -Encoding utf8 -Append Remove-Item -Path ./Version/version.txt Remove-Item -Path ./Version - name: Download Build output From ecfd7a275c8548b86f44dd0f41bd0a94d1116b05 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 28 Oct 2020 12:47:08 -0600 Subject: [PATCH 06/10] first attempt at using the new env mechanism --- .github/workflows/docker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 17fcebf..d77816a 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -44,7 +44,7 @@ jobs: shell: powershell run: | $version = ./.github/scripts/GenerateVersionNumber.ps1 - Write-Output "::set-env name=VERSION::$version" + echo "VERSION=$version" | Out-File -FilePath $env::GITHUB_ENV -Encoding utf8 -Append # Use the version number to set the version of the assemblies - name: Update AssemblyInfo.cs shell: powershell @@ -123,7 +123,7 @@ jobs: Get-ChildItem "./Version" $version = Get-Content -Path ./Version/version.txt Write-Host "Version: $version" - Write-Output "::set-env name=VERSION::$version" + echo "VERSION=$version" | Out-File -FilePath $env::GITHUB_ENV -Encoding utf8 -Append Remove-Item -Path ./Version/version.txt Remove-Item -Path ./Version - name: Download Build output From 8442bbed563010e6cece18d5f623b139efb11db9 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 28 Oct 2020 12:51:50 -0600 Subject: [PATCH 07/10] fix env path to GITHUB_ENV file --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index d77816a..c65b5b1 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -44,7 +44,7 @@ jobs: shell: powershell run: | $version = ./.github/scripts/GenerateVersionNumber.ps1 - echo "VERSION=$version" | Out-File -FilePath $env::GITHUB_ENV -Encoding utf8 -Append + echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append # Use the version number to set the version of the assemblies - name: Update AssemblyInfo.cs shell: powershell From 9b05dff707d960d88751036f75ae8b9ea2b9c05d Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 28 Oct 2020 13:10:30 -0600 Subject: [PATCH 08/10] fix : everywhere --- .github/workflows/docker.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index c65b5b1..9e09430 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -123,7 +123,7 @@ jobs: Get-ChildItem "./Version" $version = Get-Content -Path ./Version/version.txt Write-Host "Version: $version" - echo "VERSION=$version" | Out-File -FilePath $env::GITHUB_ENV -Encoding utf8 -Append + echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append Remove-Item -Path ./Version/version.txt Remove-Item -Path ./Version - name: Download Build output @@ -178,7 +178,7 @@ jobs: Get-ChildItem "./Version" $version = Get-Content -Path ./Version/version.txt Write-Host "Version: $version" - Write-Output "::set-env name=VERSION::$version" + echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append Remove-Item -Path ./Version/version.txt Remove-Item -Path ./Version # Checkout/Create the branch @@ -255,7 +255,7 @@ jobs: Get-ChildItem "./Version" $version = Get-Content -Path ./Version/version.txt Write-Host "Version: $version" - Write-Output "::set-env name=VERSION::$version" + echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append Remove-Item -Path ./Version/version.txt Remove-Item -Path ./Version # Checkout/Create the branch From acf03c1d2ea88cd3fb6e638c5113ad8780d326f4 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 28 Oct 2020 13:50:16 -0600 Subject: [PATCH 09/10] update main.yml with new ENV stuff --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b41e08c..db83b18 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,7 +37,7 @@ jobs: shell: powershell env: TAG_NAME: ${{ github.event.release.tag_name }} - run: Write-Output "::set-env name=VERSION::$($Env:TAG_NAME)" + run: echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append # Use the version number to set the version of the assemblies - name: Update AssemblyInfo.cs shell: powershell @@ -98,7 +98,7 @@ jobs: Get-ChildItem "./Version" $version = Get-Content -Path ./Version/version.txt Write-Host "Version: $version" - Write-Output "::set-env name=VERSION::$version" + echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append Remove-Item -Path ./Version/version.txt Remove-Item -Path ./Version - name: Download Build output @@ -152,7 +152,7 @@ jobs: Get-ChildItem "./Version" $version = Get-Content -Path ./Version/version.txt Write-Host "Version: $version" - Write-Output "::set-env name=VERSION::$version" + echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append Remove-Item -Path ./Version/version.txt Remove-Item -Path ./Version # Checkout/Create the branch @@ -225,7 +225,7 @@ jobs: Get-ChildItem "./Version" $version = Get-Content -Path ./Version/version.txt Write-Host "Version: $version" - Write-Output "::set-env name=VERSION::$version" + echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append Remove-Item -Path ./Version/version.txt Remove-Item -Path ./Version # Checkout/Create the branch From 5c603a636c4105323128013f6a6590fb63894d69 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 10 Nov 2020 16:06:53 -0700 Subject: [PATCH 10/10] stop AutoReconnect on initial connect also corrected a debug call to add the key --- Pepperdash Core/Pepperdash Core/Comm/GenericTcpIpClient.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Pepperdash Core/Pepperdash Core/Comm/GenericTcpIpClient.cs b/Pepperdash Core/Pepperdash Core/Comm/GenericTcpIpClient.cs index 7303d01..f151b57 100644 --- a/Pepperdash Core/Pepperdash Core/Comm/GenericTcpIpClient.cs +++ b/Pepperdash Core/Pepperdash Core/Comm/GenericTcpIpClient.cs @@ -313,7 +313,7 @@ namespace PepperDash.Core void ConnectToServerCallback(TCPClient c) { Debug.Console(1, this, "Server connection result: {0}", c.ClientStatus); - if (c.ClientStatus != SocketStatus.SOCKET_STATUS_CONNECTED) + if (c.ClientStatus != SocketStatus.SOCKET_STATUS_CONNECTED && AutoReconnect) WaitAndTryReconnect(); } @@ -326,7 +326,7 @@ namespace PepperDash.Core if (Client != null) { - Debug.Console(1, "Attempting reconnect, status={0}", Client.ClientStatus); + Debug.Console(1, this, "Attempting reconnect, status={0}", Client.ClientStatus); if (!DisconnectCalledByUser) RetryTimer = new CTimer(o => { Client.ConnectToServerAsync(ConnectToServerCallback); }, AutoReconnectIntervalMs);