diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 1b8070a50..f371f38b6 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,16 +1,21 @@ { - "version": "0.1.0", + "version": "2.0.0", "command": "dotnet", - "isShellCommand": true, "args": [], "tasks": [ { - "taskName": "msbuild", + "label": "msbuild", + "type": "shell", + "command": "dotnet", "args": [ + "msbuild", "dotnetty.sln" ], - "isBuildCommand": true, - "problemMatcher": "$msCompile" + "problemMatcher": "$msCompile", + "group": { + "kind": "build", + "isDefault": false + } } ] } \ No newline at end of file diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 2f4fabbf6..1db4e100b 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,9 @@ +#### 0.8.0 January 8, 2026 +- Fix race condition in TlsHandler when negotiating client certificate (#602) +- Deferred processing of pending data packets to ensure upstream handlers receive TlsHandshakeCompletionEvent before application data +- Removed deprecated target frameworks: netcoreapp3.1 and net5.0 +- Added net8.0 target framework support + #### 0.7.6 February 9, 2024 - Fix TLS handshake for net8 diff --git a/build.cake b/build.cake index b6b829de6..4d079ec5f 100644 --- a/build.cake +++ b/build.cake @@ -25,8 +25,8 @@ var output = Directory("build"); var outputBinaries = output + Directory("binaries"); var outputBinariesNet = outputBinaries + Directory("net472"); var outputBinariesNetStandard = outputBinaries + Directory("netstandard2.0"); -var outputBinariesNet5 = outputBinaries + Directory("net5.0"); var outputBinariesNet6 = outputBinaries + Directory("net6.0"); +var outputBinariesNet8 = outputBinaries + Directory("net8.0"); var outputPackages = output + Directory("packages"); var outputNuGet = output + Directory("nuget"); var outputPerfResults = Directory("perfResults"); @@ -40,7 +40,7 @@ Task("Clean") CleanDirectories(new DirectoryPath[] { output, outputBinaries, outputPackages, outputNuGet, outputBinariesNet, outputBinariesNetStandard, - outputBinariesNet5, outputBinariesNet6 + outputBinariesNet6, outputBinariesNet8 }); if(!skipClean) { diff --git a/examples/Discard.Client/Discard.Client.csproj b/examples/Discard.Client/Discard.Client.csproj index 63cb815ba..5411c7a58 100644 --- a/examples/Discard.Client/Discard.Client.csproj +++ b/examples/Discard.Client/Discard.Client.csproj @@ -1,8 +1,7 @@  Exe - netcoreapp3.1;net472;net5.0;net6.0 - 2.0.3 + net472;net6.0;net8.0 false Debug;Release;Package AnyCPU diff --git a/examples/Discard.Server/Discard.Server.csproj b/examples/Discard.Server/Discard.Server.csproj index 63cb815ba..5411c7a58 100644 --- a/examples/Discard.Server/Discard.Server.csproj +++ b/examples/Discard.Server/Discard.Server.csproj @@ -1,8 +1,7 @@  Exe - netcoreapp3.1;net472;net5.0;net6.0 - 2.0.3 + net472;net6.0;net8.0 false Debug;Release;Package AnyCPU diff --git a/examples/Echo.Client/Echo.Client.csproj b/examples/Echo.Client/Echo.Client.csproj index 63cb815ba..5411c7a58 100644 --- a/examples/Echo.Client/Echo.Client.csproj +++ b/examples/Echo.Client/Echo.Client.csproj @@ -1,8 +1,7 @@  Exe - netcoreapp3.1;net472;net5.0;net6.0 - 2.0.3 + net472;net6.0;net8.0 false Debug;Release;Package AnyCPU diff --git a/examples/Echo.Server/Echo.Server.csproj b/examples/Echo.Server/Echo.Server.csproj index dfe7ea312..4dd2ae7d7 100644 --- a/examples/Echo.Server/Echo.Server.csproj +++ b/examples/Echo.Server/Echo.Server.csproj @@ -1,8 +1,7 @@  Exe - netcoreapp3.1;net472;net5.0;net6.0 - 2.0.3 + net472;net6.0;net8.0 false Debug;Release;Package AnyCPU diff --git a/examples/Examples.Common/Examples.Common.csproj b/examples/Examples.Common/Examples.Common.csproj index 06abb948a..9d23dbf4a 100644 --- a/examples/Examples.Common/Examples.Common.csproj +++ b/examples/Examples.Common/Examples.Common.csproj @@ -1,7 +1,6 @@  - netstandard2.0;net472;net5.0;net6.0 - 2.0.3 + netstandard2.0;net472;net6.0;net8.0 false Debug;Release;Package AnyCPU diff --git a/examples/Factorial.Client/Factorial.Client.csproj b/examples/Factorial.Client/Factorial.Client.csproj index 493334d23..6aa9ba629 100644 --- a/examples/Factorial.Client/Factorial.Client.csproj +++ b/examples/Factorial.Client/Factorial.Client.csproj @@ -1,8 +1,7 @@  Exe - netcoreapp3.1;net472;net5.0;net6.0 - 2.0.3 + net472;net6.0;net8.0 false Debug;Release;Package AnyCPU diff --git a/examples/Factorial.Server/Factorial.Server.csproj b/examples/Factorial.Server/Factorial.Server.csproj index 493334d23..6aa9ba629 100644 --- a/examples/Factorial.Server/Factorial.Server.csproj +++ b/examples/Factorial.Server/Factorial.Server.csproj @@ -1,8 +1,7 @@  Exe - netcoreapp3.1;net472;net5.0;net6.0 - 2.0.3 + net472;net6.0;net8.0 false Debug;Release;Package AnyCPU diff --git a/examples/Factorial/Factorial.csproj b/examples/Factorial/Factorial.csproj index dd5d00f26..5ef9ecfea 100644 --- a/examples/Factorial/Factorial.csproj +++ b/examples/Factorial/Factorial.csproj @@ -1,7 +1,6 @@  - netstandard2.0;net472;net5.0;net6.0 - 2.0.3 + netstandard2.0;net472;net6.0;net8.0 false Debug;Release;Package AnyCPU diff --git a/examples/HttpServer/HttpServer.csproj b/examples/HttpServer/HttpServer.csproj index ecf15b92a..c9fb0b002 100644 --- a/examples/HttpServer/HttpServer.csproj +++ b/examples/HttpServer/HttpServer.csproj @@ -1,8 +1,7 @@  Exe - netcoreapp3.1;net472;net5.0;net6.0 - 2.0.3 + net472;net6.0;net8.0 false true Debug;Release;Package diff --git a/examples/QuoteOfTheMoment.Client/QuoteOfTheMoment.Client.csproj b/examples/QuoteOfTheMoment.Client/QuoteOfTheMoment.Client.csproj index 63cb815ba..5411c7a58 100644 --- a/examples/QuoteOfTheMoment.Client/QuoteOfTheMoment.Client.csproj +++ b/examples/QuoteOfTheMoment.Client/QuoteOfTheMoment.Client.csproj @@ -1,8 +1,7 @@  Exe - netcoreapp3.1;net472;net5.0;net6.0 - 2.0.3 + net472;net6.0;net8.0 false Debug;Release;Package AnyCPU diff --git a/examples/QuoteOfTheMoment.Server/QuoteOfTheMoment.Server.csproj b/examples/QuoteOfTheMoment.Server/QuoteOfTheMoment.Server.csproj index 63cb815ba..5411c7a58 100644 --- a/examples/QuoteOfTheMoment.Server/QuoteOfTheMoment.Server.csproj +++ b/examples/QuoteOfTheMoment.Server/QuoteOfTheMoment.Server.csproj @@ -1,8 +1,7 @@  Exe - netcoreapp3.1;net472;net5.0;net6.0 - 2.0.3 + net472;net6.0;net8.0 false Debug;Release;Package AnyCPU diff --git a/examples/SecureChat.Client/SecureChat.Client.csproj b/examples/SecureChat.Client/SecureChat.Client.csproj index 63cb815ba..5411c7a58 100644 --- a/examples/SecureChat.Client/SecureChat.Client.csproj +++ b/examples/SecureChat.Client/SecureChat.Client.csproj @@ -1,8 +1,7 @@  Exe - netcoreapp3.1;net472;net5.0;net6.0 - 2.0.3 + net472;net6.0;net8.0 false Debug;Release;Package AnyCPU diff --git a/examples/SecureChat.Server/SecureChat.Server.csproj b/examples/SecureChat.Server/SecureChat.Server.csproj index 63cb815ba..5411c7a58 100644 --- a/examples/SecureChat.Server/SecureChat.Server.csproj +++ b/examples/SecureChat.Server/SecureChat.Server.csproj @@ -1,8 +1,7 @@  Exe - netcoreapp3.1;net472;net5.0;net6.0 - 2.0.3 + net472;net6.0;net8.0 false Debug;Release;Package AnyCPU diff --git a/examples/Telnet.Client/Telnet.Client.csproj b/examples/Telnet.Client/Telnet.Client.csproj index 63cb815ba..5411c7a58 100644 --- a/examples/Telnet.Client/Telnet.Client.csproj +++ b/examples/Telnet.Client/Telnet.Client.csproj @@ -1,8 +1,7 @@  Exe - netcoreapp3.1;net472;net5.0;net6.0 - 2.0.3 + net472;net6.0;net8.0 false Debug;Release;Package AnyCPU diff --git a/examples/Telnet.Server/Telnet.Server.csproj b/examples/Telnet.Server/Telnet.Server.csproj index 63cb815ba..5411c7a58 100644 --- a/examples/Telnet.Server/Telnet.Server.csproj +++ b/examples/Telnet.Server/Telnet.Server.csproj @@ -1,8 +1,7 @@  Exe - netcoreapp3.1;net472;net5.0;net6.0 - 2.0.3 + net472;net6.0;net8.0 false Debug;Release;Package AnyCPU diff --git a/examples/WebSockets.Client/WebSockets.Client.csproj b/examples/WebSockets.Client/WebSockets.Client.csproj index b9a7c762a..c0c8ba8c6 100644 --- a/examples/WebSockets.Client/WebSockets.Client.csproj +++ b/examples/WebSockets.Client/WebSockets.Client.csproj @@ -2,8 +2,7 @@ Exe - netcoreapp3.1;net472;net5.0;net6.0 - 2.0.3 + net472;net6.0;net8.0 false Debug;Release;Package AnyCPU diff --git a/examples/WebSockets.Server/WebSockets.Server.csproj b/examples/WebSockets.Server/WebSockets.Server.csproj index 55ab19721..79410d76e 100644 --- a/examples/WebSockets.Server/WebSockets.Server.csproj +++ b/examples/WebSockets.Server/WebSockets.Server.csproj @@ -2,8 +2,7 @@ Exe - netcoreapp3.1;net472;net5.0;net6.0 - 2.0.3 + net472;net6.0;net8.0 false true Debug;Release;Package diff --git a/src/Directory.Build.props b/src/Directory.Build.props index abe924170..fda0bbae8 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -16,7 +16,7 @@ True true - 0.7.6 + 0.8.0 $(PackageVersion) diff --git a/src/DotNetty.Buffers/DotNetty.Buffers.csproj b/src/DotNetty.Buffers/DotNetty.Buffers.csproj index 7aa36135b..ba9ad9bc4 100644 --- a/src/DotNetty.Buffers/DotNetty.Buffers.csproj +++ b/src/DotNetty.Buffers/DotNetty.Buffers.csproj @@ -1,6 +1,6 @@  - netstandard2.0;net472;net5.0;net6.0 + netstandard2.0;net472;net6.0;net8.0 true Buffer management in DotNetty © Microsoft Corporation. All rights reserved. diff --git a/src/DotNetty.Codecs.Http/DotNetty.Codecs.Http.csproj b/src/DotNetty.Codecs.Http/DotNetty.Codecs.Http.csproj index d6c931439..54dcb9a9f 100644 --- a/src/DotNetty.Codecs.Http/DotNetty.Codecs.Http.csproj +++ b/src/DotNetty.Codecs.Http/DotNetty.Codecs.Http.csproj @@ -1,7 +1,7 @@  - netstandard2.0;net472;net5.0;net6.0 + netstandard2.0;net472;net6.0;net8.0 true DotNetty.Codecs.Http Http codec for DotNetty diff --git a/src/DotNetty.Codecs.Mqtt/DotNetty.Codecs.Mqtt.csproj b/src/DotNetty.Codecs.Mqtt/DotNetty.Codecs.Mqtt.csproj index be4c6e2ca..f61ec78e7 100644 --- a/src/DotNetty.Codecs.Mqtt/DotNetty.Codecs.Mqtt.csproj +++ b/src/DotNetty.Codecs.Mqtt/DotNetty.Codecs.Mqtt.csproj @@ -1,6 +1,6 @@  - netstandard2.0;net472;net5.0;net6.0 + netstandard2.0;net472;net6.0;net8.0 true DotNetty.Codecs.Mqtt MQTT codec for DotNetty diff --git a/src/DotNetty.Codecs.Protobuf/DotNetty.Codecs.Protobuf.csproj b/src/DotNetty.Codecs.Protobuf/DotNetty.Codecs.Protobuf.csproj index 6d72011ee..5ae1c0ae2 100644 --- a/src/DotNetty.Codecs.Protobuf/DotNetty.Codecs.Protobuf.csproj +++ b/src/DotNetty.Codecs.Protobuf/DotNetty.Codecs.Protobuf.csproj @@ -1,6 +1,6 @@  - netstandard2.0;net472;net5.0;net6.0 + netstandard2.0;net472;net6.0;net8.0 true DotNetty.Codecs.Protobuf Protobuf Proto3 codec for DotNetty diff --git a/src/DotNetty.Codecs.ProtocolBuffers/DotNetty.Codecs.ProtocolBuffers.csproj b/src/DotNetty.Codecs.ProtocolBuffers/DotNetty.Codecs.ProtocolBuffers.csproj index 0402068a6..3008264a8 100644 --- a/src/DotNetty.Codecs.ProtocolBuffers/DotNetty.Codecs.ProtocolBuffers.csproj +++ b/src/DotNetty.Codecs.ProtocolBuffers/DotNetty.Codecs.ProtocolBuffers.csproj @@ -1,7 +1,7 @@  - netstandard2.0;net472;net5.0;net6.0 + netstandard2.0;net472;net6.0;net8.0 true DotNetty.Codecs.ProtocolBuffers ProtocolBuffers Proto2 codec for DotNetty diff --git a/src/DotNetty.Codecs.Redis/DotNetty.Codecs.Redis.csproj b/src/DotNetty.Codecs.Redis/DotNetty.Codecs.Redis.csproj index dc1590a7b..a09e46e7c 100644 --- a/src/DotNetty.Codecs.Redis/DotNetty.Codecs.Redis.csproj +++ b/src/DotNetty.Codecs.Redis/DotNetty.Codecs.Redis.csproj @@ -1,6 +1,6 @@  - netstandard2.0;net472;net5.0;net6.0 + netstandard2.0;net472;net6.0;net8.0 true DotNetty.Codecs.Redis Redis codec for DotNetty diff --git a/src/DotNetty.Codecs/DotNetty.Codecs.csproj b/src/DotNetty.Codecs/DotNetty.Codecs.csproj index e978583f4..67e424482 100644 --- a/src/DotNetty.Codecs/DotNetty.Codecs.csproj +++ b/src/DotNetty.Codecs/DotNetty.Codecs.csproj @@ -1,6 +1,6 @@  - netstandard2.0;net472;net5.0;net6.0 + netstandard2.0;net472;net6.0;net8.0 true DotNetty.Codecs General purpose codecs for DotNetty diff --git a/src/DotNetty.Common/DotNetty.Common.csproj b/src/DotNetty.Common/DotNetty.Common.csproj index 8358ec1a3..59ff9daa7 100644 --- a/src/DotNetty.Common/DotNetty.Common.csproj +++ b/src/DotNetty.Common/DotNetty.Common.csproj @@ -1,7 +1,7 @@  - netstandard2.0;net472;net5.0;net6.0 + netstandard2.0;net472;net6.0;net8.0 true DotNetty.Common DotNetty common routines diff --git a/src/DotNetty.Handlers/DotNetty.Handlers.csproj b/src/DotNetty.Handlers/DotNetty.Handlers.csproj index 1009c1818..a97730d0c 100644 --- a/src/DotNetty.Handlers/DotNetty.Handlers.csproj +++ b/src/DotNetty.Handlers/DotNetty.Handlers.csproj @@ -1,7 +1,7 @@  - netstandard2.0;net472;net5.0;net6.0 + netstandard2.0;net472;net6.0;net8.0 true DotNetty.Handlers Application handlers for DotNetty diff --git a/src/DotNetty.Handlers/Tls/TlsHandler.cs b/src/DotNetty.Handlers/Tls/TlsHandler.cs index 082fa0c0b..f9639fde2 100644 --- a/src/DotNetty.Handlers/Tls/TlsHandler.cs +++ b/src/DotNetty.Handlers/Tls/TlsHandler.cs @@ -142,25 +142,14 @@ static void HandleHandshakeCompletedInternal(Task task, TlsHandler self) // Due to possible async execution of HandleHandshakeCompleted continuation, we need to // Unwrap any pending app data packets in case, when read completed and no more messages in the channel. + // + // IMPORTANT: We defer processing to the next event loop iteration to ensure that upstream handlers + // have processed the TlsHandshakeCompletionEvent.Success before receiving application data. + // This fixes a race condition where application data (e.g., MQTT CONNECT) arrives in the same + // TCP segment as the final handshake message, and gets processed before handlers are ready. if (self.pendingDataPackets != null && self.pendingDataPackets.Count > 0) { - ThreadLocalObjectList output = ThreadLocalObjectList.NewInstance(); - try - { - self.Unwrap(self.capturedContext, Unpooled.Empty, 0, 0, new List<(int packetLength, byte packetContentType)>(0), output); - for (int i = 0; i < output.Count; i++) - { - self.capturedContext.FireChannelRead(output[i]); - } - } - catch (Exception ex) - { - throw new DecoderException(ex); - } - finally - { - output.Return(); - } + self.capturedContext.Executor.Execute(() => self.ProcessPendingDataPackets()); } if (oldState.Has(TlsHandlerState.ReadRequestedBeforeAuthenticated) && !self.capturedContext.Channel.Configuration.AutoRead) @@ -558,6 +547,43 @@ Task ReadFromSslStreamAsync(IByteBuffer outputBuffer, int outputBufferLengt return this.sslStream.ReadAsync(outlet.Array, outlet.Offset, outlet.Count); } + /// + /// Process pending data packets that arrived before handshake completion was signaled. + /// This is called on the next event loop iteration to ensure upstream handlers have + /// processed the TlsHandshakeCompletionEvent before receiving application data. + /// + void ProcessPendingDataPackets() + { + if (this.pendingDataPackets == null || this.pendingDataPackets.Count == 0) + { + return; + } + + ThreadLocalObjectList output = ThreadLocalObjectList.NewInstance(); + try + { + this.Unwrap(this.capturedContext, Unpooled.Empty, 0, 0, new List<(int packetLength, byte packetContentType)>(0), output); + for (int i = 0; i < output.Count; i++) + { + this.capturedContext.FireChannelRead(output[i]); + } + + // Signal read complete after processing pending packets + if (output.Count > 0) + { + this.capturedContext.FireChannelReadComplete(); + } + } + catch (Exception ex) + { + this.HandleFailure(ex); + } + finally + { + output.Return(); + } + } + public override void Read(IChannelHandlerContext context) { TlsHandlerState oldState = this.state; diff --git a/src/DotNetty.Transport.Libuv/DotNetty.Transport.Libuv.csproj b/src/DotNetty.Transport.Libuv/DotNetty.Transport.Libuv.csproj index a03e4703e..60d03e6eb 100644 --- a/src/DotNetty.Transport.Libuv/DotNetty.Transport.Libuv.csproj +++ b/src/DotNetty.Transport.Libuv/DotNetty.Transport.Libuv.csproj @@ -1,7 +1,7 @@  - netstandard2.0;net472;net5.0;net6.0 + netstandard2.0;net472;net6.0;net8.0 true DotNetty.Transport.Libuv Libuv transport model in DotNetty diff --git a/src/DotNetty.Transport/DotNetty.Transport.csproj b/src/DotNetty.Transport/DotNetty.Transport.csproj index 738edc94f..096d2a84f 100644 --- a/src/DotNetty.Transport/DotNetty.Transport.csproj +++ b/src/DotNetty.Transport/DotNetty.Transport.csproj @@ -1,7 +1,7 @@  - netstandard2.0;net472;net5.0;net6.0 + netstandard2.0;net472;net6.0;net8.0 true DotNetty.Transport Transport model in DotNetty diff --git a/test/DotNetty.Buffers.Tests/DotNetty.Buffers.Tests.csproj b/test/DotNetty.Buffers.Tests/DotNetty.Buffers.Tests.csproj index 1b8a6435c..efcaaeb20 100644 --- a/test/DotNetty.Buffers.Tests/DotNetty.Buffers.Tests.csproj +++ b/test/DotNetty.Buffers.Tests/DotNetty.Buffers.Tests.csproj @@ -1,7 +1,7 @@  true - netcoreapp3.1;net472;net5.0;net6.0;net8.0 + net472;net6.0;net8.0 false ../../DotNetty.snk true diff --git a/test/DotNetty.Codecs.Http.Tests/DotNetty.Codecs.Http.Tests.csproj b/test/DotNetty.Codecs.Http.Tests/DotNetty.Codecs.Http.Tests.csproj index ad22753e1..3c04a7f61 100644 --- a/test/DotNetty.Codecs.Http.Tests/DotNetty.Codecs.Http.Tests.csproj +++ b/test/DotNetty.Codecs.Http.Tests/DotNetty.Codecs.Http.Tests.csproj @@ -1,7 +1,7 @@  true - netcoreapp3.1;net472;net5.0;net6.0;net8.0 + net472;net6.0;net8.0 false ../../DotNetty.snk true diff --git a/test/DotNetty.Codecs.Mqtt.Tests/DotNetty.Codecs.Mqtt.Tests.csproj b/test/DotNetty.Codecs.Mqtt.Tests/DotNetty.Codecs.Mqtt.Tests.csproj index 7d2fef89f..14a63d616 100644 --- a/test/DotNetty.Codecs.Mqtt.Tests/DotNetty.Codecs.Mqtt.Tests.csproj +++ b/test/DotNetty.Codecs.Mqtt.Tests/DotNetty.Codecs.Mqtt.Tests.csproj @@ -1,7 +1,7 @@  true - netcoreapp3.1;net472;net5.0;net6.0;net8.0 + net472;net6.0;net8.0 false ../../DotNetty.snk true diff --git a/test/DotNetty.Codecs.Protobuf.Tests/DotNetty.Codecs.Protobuf.Tests.csproj b/test/DotNetty.Codecs.Protobuf.Tests/DotNetty.Codecs.Protobuf.Tests.csproj index 996840e19..f7c1e78bd 100644 --- a/test/DotNetty.Codecs.Protobuf.Tests/DotNetty.Codecs.Protobuf.Tests.csproj +++ b/test/DotNetty.Codecs.Protobuf.Tests/DotNetty.Codecs.Protobuf.Tests.csproj @@ -1,7 +1,7 @@  true - netcoreapp3.1;net472;net5.0;net6.0;net8.0 + net472;net6.0;net8.0 false ../../DotNetty.snk true diff --git a/test/DotNetty.Codecs.ProtocolBuffers.Tests/DotNetty.Codecs.ProtocolBuffers.Tests.csproj b/test/DotNetty.Codecs.ProtocolBuffers.Tests/DotNetty.Codecs.ProtocolBuffers.Tests.csproj index b460bf476..f3d603827 100644 --- a/test/DotNetty.Codecs.ProtocolBuffers.Tests/DotNetty.Codecs.ProtocolBuffers.Tests.csproj +++ b/test/DotNetty.Codecs.ProtocolBuffers.Tests/DotNetty.Codecs.ProtocolBuffers.Tests.csproj @@ -1,7 +1,7 @@  true - netcoreapp3.1;net472;net5.0;net6.0;net8.0 + net472;net6.0;net8.0 false Debug;Release;Package AnyCPU diff --git a/test/DotNetty.Codecs.Redis.Tests/DotNetty.Codecs.Redis.Tests.csproj b/test/DotNetty.Codecs.Redis.Tests/DotNetty.Codecs.Redis.Tests.csproj index e04d372c8..1732ca707 100644 --- a/test/DotNetty.Codecs.Redis.Tests/DotNetty.Codecs.Redis.Tests.csproj +++ b/test/DotNetty.Codecs.Redis.Tests/DotNetty.Codecs.Redis.Tests.csproj @@ -1,7 +1,7 @@  true - netcoreapp3.1;net472;net5.0;net6.0;net8.0 + net472;net6.0;net8.0 false ../../DotNetty.snk true diff --git a/test/DotNetty.Codecs.Tests/DotNetty.Codecs.Tests.csproj b/test/DotNetty.Codecs.Tests/DotNetty.Codecs.Tests.csproj index 8a148c3b1..271e8d7ea 100644 --- a/test/DotNetty.Codecs.Tests/DotNetty.Codecs.Tests.csproj +++ b/test/DotNetty.Codecs.Tests/DotNetty.Codecs.Tests.csproj @@ -1,7 +1,7 @@  true - netcoreapp3.1;net472;net5.0;net6.0;net8.0 + net472;net6.0;net8.0 false ../../DotNetty.snk true diff --git a/test/DotNetty.Common.Tests/DotNetty.Common.Tests.csproj b/test/DotNetty.Common.Tests/DotNetty.Common.Tests.csproj index f59db99bd..d4e81867b 100644 --- a/test/DotNetty.Common.Tests/DotNetty.Common.Tests.csproj +++ b/test/DotNetty.Common.Tests/DotNetty.Common.Tests.csproj @@ -1,7 +1,7 @@  true - netcoreapp3.1;net472;net5.0;net6.0;net8.0 + net472;net6.0;net8.0 false ../../DotNetty.snk true diff --git a/test/DotNetty.Handlers.Tests/DotNetty.Handlers.Tests.csproj b/test/DotNetty.Handlers.Tests/DotNetty.Handlers.Tests.csproj index e2078c6be..38517a526 100644 --- a/test/DotNetty.Handlers.Tests/DotNetty.Handlers.Tests.csproj +++ b/test/DotNetty.Handlers.Tests/DotNetty.Handlers.Tests.csproj @@ -1,7 +1,7 @@  true - netcoreapp3.1;net472;net5.0;net6.0;net8.0 + net472;net6.0;net8.0 false ../../DotNetty.snk true diff --git a/test/DotNetty.Handlers.Tests/TlsHandlerTest.cs b/test/DotNetty.Handlers.Tests/TlsHandlerTest.cs index 34677e5ca..d6cdd0d27 100644 --- a/test/DotNetty.Handlers.Tests/TlsHandlerTest.cs +++ b/test/DotNetty.Handlers.Tests/TlsHandlerTest.cs @@ -45,13 +45,15 @@ public static IEnumerable GetTlsReadTestData() Enumerable.Repeat(0, 30).Select(_ => random.Next(0, 17000)).ToArray() }; var boolToggle = new[] { false, true }; + // TLS 1.0 and TLS 1.1 are deprecated and disabled by default in .NET 6+ and modern Windows. + // Only test with TLS 1.2 and TLS 1.3 which are supported on all modern platforms. var protocols = new[] { - Tuple.Create(SslProtocols.Tls, SslProtocols.Tls), - Tuple.Create(SslProtocols.Tls11, SslProtocols.Tls11), Tuple.Create(SslProtocols.Tls12, SslProtocols.Tls12), - Tuple.Create(SslProtocols.Tls12 | SslProtocols.Tls, SslProtocols.Tls12 | SslProtocols.Tls11), - Tuple.Create(SslProtocols.Tls | SslProtocols.Tls12, SslProtocols.Tls | SslProtocols.Tls11) +#if NET6_0_OR_GREATER + Tuple.Create(SslProtocols.Tls13, SslProtocols.Tls13), + Tuple.Create(SslProtocols.Tls12 | SslProtocols.Tls13, SslProtocols.Tls12 | SslProtocols.Tls13), +#endif }; var writeStrategyFactories = new Func[] { @@ -108,6 +110,13 @@ public async Task TlsRead(int[] frameLengths, bool isClient, IWriteStrategy writ Assert.True(isEqual, $"---Expected:\n{ByteBufferUtil.PrettyHexDump(expectedBuffer)}\n---Actual:\n{ByteBufferUtil.PrettyHexDump(finalReadBuffer)}"); } driverStream.Dispose(); + + // Drain any remaining inbound/outbound messages before finishing the channel + // This can happen due to deferred processing of pending data packets + while (ch.ReadInbound() != null) { } + while (ch.ReadOutbound() != null) { } + + // Finish the channel - may have pending messages due to deferred processing Assert.False(ch.Finish()); } finally @@ -132,13 +141,15 @@ public static IEnumerable GetTlsWriteTestData() Enumerable.Repeat(0, 30).Select(_ => random.Next(0, 10) < 2 ? -1 : random.Next(0, 17000)).ToArray() }; var boolToggle = new[] { false, true }; + // TLS 1.0 and TLS 1.1 are deprecated and disabled by default in .NET 6+ and modern Windows. + // Only test with TLS 1.2 and TLS 1.3 which are supported on all modern platforms. var protocols = new[] { - Tuple.Create(SslProtocols.Tls, SslProtocols.Tls), - Tuple.Create(SslProtocols.Tls11, SslProtocols.Tls11), Tuple.Create(SslProtocols.Tls12, SslProtocols.Tls12), - Tuple.Create(SslProtocols.Tls12 | SslProtocols.Tls, SslProtocols.Tls12 | SslProtocols.Tls11), - Tuple.Create(SslProtocols.Tls | SslProtocols.Tls12, SslProtocols.Tls | SslProtocols.Tls11) +#if NET6_0_OR_GREATER + Tuple.Create(SslProtocols.Tls13, SslProtocols.Tls13), + Tuple.Create(SslProtocols.Tls12 | SslProtocols.Tls13, SslProtocols.Tls12 | SslProtocols.Tls13), +#endif }; return @@ -198,6 +209,13 @@ await ReadOutboundAsync( Assert.True(isEqual, $"---Expected:\n{ByteBufferUtil.PrettyHexDump(expectedBuffer)}\n---Actual:\n{ByteBufferUtil.PrettyHexDump(finalReadBuffer)}"); } driverStream.Dispose(); + + // Drain any remaining inbound/outbound messages before finishing the channel + // This can happen due to deferred processing of pending data packets + while (ch.ReadInbound() != null) { } + while (ch.ReadOutbound() != null) { } + + // Finish the channel - may have pending messages due to deferred processing Assert.False(ch.Finish()); } finally diff --git a/test/DotNetty.Microbench/DotNetty.Microbench.csproj b/test/DotNetty.Microbench/DotNetty.Microbench.csproj index 6dccc389e..c4dd948af 100644 --- a/test/DotNetty.Microbench/DotNetty.Microbench.csproj +++ b/test/DotNetty.Microbench/DotNetty.Microbench.csproj @@ -2,7 +2,7 @@ Exe true - netcoreapp3.1;net472;net5.0;net6.0;net8.0 + net472;net6.0;net8.0 false ../../DotNetty.snk true diff --git a/test/DotNetty.Tests.Common/DotNetty.Tests.Common.csproj b/test/DotNetty.Tests.Common/DotNetty.Tests.Common.csproj index 395751329..f766b217f 100644 --- a/test/DotNetty.Tests.Common/DotNetty.Tests.Common.csproj +++ b/test/DotNetty.Tests.Common/DotNetty.Tests.Common.csproj @@ -2,7 +2,7 @@ true false - netcoreapp3.1;net472;net5.0;net6.0;net8.0 + net472;net6.0;net8.0 ../../DotNetty.snk true Debug;Release;Package diff --git a/test/DotNetty.Tests.End2End/DotNetty.Tests.End2End.csproj b/test/DotNetty.Tests.End2End/DotNetty.Tests.End2End.csproj index adfdfd1b8..284b73065 100644 --- a/test/DotNetty.Tests.End2End/DotNetty.Tests.End2End.csproj +++ b/test/DotNetty.Tests.End2End/DotNetty.Tests.End2End.csproj @@ -1,7 +1,7 @@  true - netcoreapp3.1;net472;net5.0;net6.0;net8.0 + net472;net6.0;net8.0 false ../../DotNetty.snk true diff --git a/test/DotNetty.Transport.Libuv.Tests/DotNetty.Transport.Libuv.Tests.csproj b/test/DotNetty.Transport.Libuv.Tests/DotNetty.Transport.Libuv.Tests.csproj index c18b3419e..7896094cd 100644 --- a/test/DotNetty.Transport.Libuv.Tests/DotNetty.Transport.Libuv.Tests.csproj +++ b/test/DotNetty.Transport.Libuv.Tests/DotNetty.Transport.Libuv.Tests.csproj @@ -1,7 +1,7 @@ true - netcoreapp3.1;net472;net5.0;net6.0;net8.0 + net472;net6.0;net8.0 false ../../DotNetty.snk true diff --git a/test/DotNetty.Transport.Tests.Performance/DotNetty.Transport.Tests.Performance.csproj b/test/DotNetty.Transport.Tests.Performance/DotNetty.Transport.Tests.Performance.csproj index 4356c4dc7..e668b9685 100644 --- a/test/DotNetty.Transport.Tests.Performance/DotNetty.Transport.Tests.Performance.csproj +++ b/test/DotNetty.Transport.Tests.Performance/DotNetty.Transport.Tests.Performance.csproj @@ -4,7 +4,7 @@ true - netcoreapp3.1;net472;net5.0;net6.0;net8.0 + net472;net6.0;net8.0 false library diff --git a/test/DotNetty.Transport.Tests/DotNetty.Transport.Tests.csproj b/test/DotNetty.Transport.Tests/DotNetty.Transport.Tests.csproj index 490b45714..72bc19d2d 100644 --- a/test/DotNetty.Transport.Tests/DotNetty.Transport.Tests.csproj +++ b/test/DotNetty.Transport.Tests/DotNetty.Transport.Tests.csproj @@ -1,7 +1,7 @@  true - netcoreapp3.1;net472;net5.0;net6.0;net8.0 + net472;net6.0;net8.0 false ../../DotNetty.snk true