Merge pull request #616 from nivalxer/fix_tls_net8

Fix the issue of TLS handshake failure in .NET 8 environment.
This commit is contained in:
Filip Stankovski 2024-02-06 15:37:08 -08:00 коммит произвёл GitHub
Родитель 296166bae9 392137ecb3
Коммит 5ccd19f13b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
18 изменённых файлов: 28 добавлений и 16 удалений

Просмотреть файл

@ -1,7 +1,7 @@
version: 0.7.0.{build}
pull_requests:
do_not_increment_build_number: true
image: Visual Studio 2019
image: Visual Studio 2022
build_script:
- cmd: powershell .\build.ps1 -target PR
test: off

Просмотреть файл

@ -69,6 +69,11 @@ namespace DotNetty.Handlers.Tls
int read = this.ReadFromInput(buffer);
return new ValueTask<int>(read);
}
//.NET8 sslStream will return 0 sometimes.like:https://github.com/dotnet/wcf/issues/5205
if (buffer.IsEmpty)
{
return new ValueTask<int>(0);
}
Contract.Assert(this.sslOwnedMemory.IsEmpty);
// take note of buffer - we will pass bytes there once available
@ -89,6 +94,12 @@ namespace DotNetty.Handlers.Tls
return Task.FromResult(read);
}
//.NET8 sslStream will return 0 sometimes.like:https://github.com/dotnet/wcf/issues/5205
if (buffer.IsEmpty)
{
return Task.FromResult(0);
}
Contract.Assert(this.sslOwnedMemory.IsEmpty);
// take note of buffer - we will pass bytes there once available
this.sslOwnedMemory = buffer;

Просмотреть файл

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworks>netcoreapp3.1;net472;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net472;net5.0;net6.0;net8.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyOriginatorKeyFile>../../DotNetty.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>

Просмотреть файл

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworks>netcoreapp3.1;net472;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net472;net5.0;net6.0;net8.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyOriginatorKeyFile>../../DotNetty.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>

Просмотреть файл

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworks>netcoreapp3.1;net472;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net472;net5.0;net6.0;net8.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyOriginatorKeyFile>../../DotNetty.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>

Просмотреть файл

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworks>netcoreapp3.1;net472;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net472;net5.0;net6.0;net8.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyOriginatorKeyFile>../../DotNetty.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>

Просмотреть файл

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworks>netcoreapp3.1;net472;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net472;net5.0;net6.0;net8.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Configurations>Debug;Release;Package</Configurations>
<Platforms>AnyCPU</Platforms>

Просмотреть файл

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworks>netcoreapp3.1;net472;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net472;net5.0;net6.0;net8.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyOriginatorKeyFile>../../DotNetty.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>

Просмотреть файл

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworks>netcoreapp3.1;net472;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net472;net5.0;net6.0;net8.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyOriginatorKeyFile>../../DotNetty.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>

Просмотреть файл

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworks>netcoreapp3.1;net472;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net472;net5.0;net6.0;net8.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyOriginatorKeyFile>../../DotNetty.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>

Просмотреть файл

@ -11,6 +11,7 @@ namespace DotNetty.Common.Tests.Utilities
using DotNetty.Tests.Common;
using Xunit;
using Xunit.Abstractions;
using ITimer = DotNetty.Common.Utilities.ITimer;
public class HashedWheelTimerTest : TestBase
{

Просмотреть файл

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworks>netcoreapp3.1;net472;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net472;net5.0;net6.0;net8.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyOriginatorKeyFile>../../DotNetty.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>

Просмотреть файл

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworks>netcoreapp3.1;net472;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net472;net5.0;net6.0;net8.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyOriginatorKeyFile>../../DotNetty.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>

Просмотреть файл

@ -2,7 +2,7 @@
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<TargetFrameworks>netcoreapp3.1;net472;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net472;net5.0;net6.0;net8.0</TargetFrameworks>
<AssemblyOriginatorKeyFile>../../DotNetty.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<Configurations>Debug;Release;Package</Configurations>

Просмотреть файл

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworks>netcoreapp3.1;net472;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net472;net5.0;net6.0;net8.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyOriginatorKeyFile>../../DotNetty.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>

Просмотреть файл

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworks>netcoreapp3.1;net472;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net472;net5.0;net6.0;net8.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyOriginatorKeyFile>../../DotNetty.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>

Просмотреть файл

@ -4,7 +4,7 @@
</PropertyGroup>
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworks>netcoreapp3.1;net472;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net472;net5.0;net6.0;net8.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<ApplicationIcon />
<OutputTypeEx>library</OutputTypeEx>

Просмотреть файл

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworks>netcoreapp3.1;net472;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net472;net5.0;net6.0;net8.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyOriginatorKeyFile>../../DotNetty.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>