diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 126fe79..c6b38ac 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,7 +42,7 @@ jobs: run: msbuild $env:Solution_Name /p:Configuration=Debug /p:Platform="Any CPU" - name: Telnet.CiTests - uses: microsoft/vstest-action@v1.0.0 + uses: rusty-bender/vstest-action@main with: testAssembly: PrimS.Telnet.CiTests.dll searchFolder: ./**/bin/Debug/**/ @@ -50,7 +50,7 @@ jobs: # Can't apparently run both full fat and core test suites together.' - name: Telnet.*.CiTests - uses: microsoft/vstest-action@v1.0.0 + uses: rusty-bender/vstest-action@main with: testAssembly: PrimS.Telnet.*.CiTests.dll searchFolder: ./**/bin/Debug/**/ @@ -89,12 +89,14 @@ jobs: - name: Nuget pack run: nuget pack Telnet.nuspec -Version $Env:NuGetVersionV2ext - # Navigate to repo->Settings->Actions and check PUBLISH_TO_GITHUB_PACKAGES + # Navigate to https://github.com/settings/tokens and check to see if the old token has expired # https://github.com/settings/tokens to create a new classic token, permission write:packages, name & copy paste to PUBLISH_TO_GITHUB_PACKAGES + # Navigate to repo->Settings->Secrets and variables->Actions and check PUBLISH_TO_GITHUB_PACKAGES - name: Publish to GitHub run: dotnet nuget push "Telnet.$Env:NuGetVersionV2ext.nupkg" --api-key ${{ secrets.PUBLISH_TO_GITHUB_PACKAGES }} --source "https://nuget.pkg.github.com/9swampy/index.json" - # Login to Nuget 9swampy->Api Keys and regenerate, copy to NUGET_APIKEY + # Login to Nuget 9swampy->Api Keys and regenerate, copy to... + # GitHub navigate to repo->Settings->Secrets and variables->Actions and set NUGET_APIKEY - name: Publish to Nuget if: github.ref == 'refs/heads/master' run: nuget push "Telnet.$Env:NuGetVersionV2ext.nupkg" ${{ secrets.NUGET_APIKEY }} -source https://api.nuget.org/v3/index.json diff --git a/PrimS.Telnet.NetStandard/Client_Config.cs b/PrimS.Telnet.NetStandard/Client_Config.cs index 4dedcf4..5e0103e 100644 --- a/PrimS.Telnet.NetStandard/Client_Config.cs +++ b/PrimS.Telnet.NetStandard/Client_Config.cs @@ -23,6 +23,11 @@ public partial class Client /// public const string Rfc854LineFeed = "\r\n"; + /// + /// Due to https://github.com/9swampy/Telnet/issues/79 allow skip SkipProactiveOptionNegotiation. + /// + public static bool SkipProactiveOptionNegotiation { get; set; } = false; + /// /// Initialises a new instance of the class. /// @@ -84,14 +89,22 @@ public Client(IByteStream byteStream, TimeSpan timeout, CancellationToken token, #if ASYNC #pragma warning disable VSTHRD002 // Avoid problematic synchronous waits // https://stackoverflow.com/questions/70964917/optimising-an-asynchronous-call-in-a-constructor-using-joinabletaskfactory-run - Task.Run(async () => await ProactiveOptionNegotiation().ConfigureAwait(false)).Wait(); + if (!SkipProactiveOptionNegotiation) + { + Task.Run(async () => await ProactiveOptionNegotiation().ConfigureAwait(false)).Wait(); + } + foreach (var option in options) { Task.Run(async () => await NegotiateOption(option.Command, option.Option).ConfigureAwait(false)).Wait(); } #pragma warning restore VSTHRD002 // Avoid problematic synchronous waits #else - ProactiveOptionNegotiation(); + if (!SkipProactiveOptionNegotiation) + { + ProactiveOptionNegotiation(); + } + foreach (var option in options) { NegotiateOption(option.Command, option.Option); @@ -142,7 +155,7 @@ internal static byte[] SuppressGoAheadBuffer #if ASYNC return ByteStream.WriteAsync(supressGoAhead, 0, supressGoAhead.Length, InternalCancellation.Token); #else - ByteStream.Write(supressGoAhead, 0, supressGoAhead.Length); + ByteStream.Write(supressGoAhead, 0, supressGoAhead.Length); #endif } diff --git a/Telnet.nuspec b/Telnet.nuspec index e715471..ee3330b 100644 --- a/Telnet.nuspec +++ b/Telnet.nuspec @@ -17,7 +17,7 @@ docs\README.md - 0.12 adds a Net8.0 target and extends the Client ctor to additionally accept options to send during negotiation. + 0.13 extends the Client with a static flag SkipProactiveOptionNegotiation due to https://github.com/9swampy/Telnet/issues/79. Copyright (c) 9swampy, Telnet contributors Telnet