未验证 提交 8986374e 编写于 作者: M Marie Píchová 提交者: GitHub

[QUIC] Merge 7.0 fix (#90228)

* Merge pull request #90173 from vseanreesermsft/internal-merge-7.0-2023-08-08-1042

Merging internal commits for release/7.0

* Consume MsQuic release package on Win

---------
Co-authored-by: NCarlos Sánchez López <1175054+carlossanlop@users.noreply.github.com>
Co-authored-by: NNatalia Kondratyeva <knatalia@microsoft.com>
上级 a19585dd
......@@ -217,7 +217,7 @@
<!-- ICU -->
<MicrosoftNETCoreRuntimeICUTransportVersion>8.0.0-rc.1.23407.2</MicrosoftNETCoreRuntimeICUTransportVersion>
<!-- MsQuic -->
<MicrosoftNativeQuicMsQuicVersion>2.1.7</MicrosoftNativeQuicMsQuicVersion>
<MicrosoftNativeQuicMsQuicVersion>2.2.2</MicrosoftNativeQuicMsQuicVersion>
<SystemNetMsQuicTransportVersion>8.0.0-alpha.1.23180.2</SystemNetMsQuicTransportVersion>
<!-- Mono LLVM -->
<runtimelinuxarm64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>16.0.5-alpha.1.23408.1</runtimelinuxarm64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>
......
......@@ -14,7 +14,7 @@
<ApiExclusionListPath Condition="'$(TargetPlatformIdentifier)' == ''">ExcludeApiList.PNSE.txt</ApiExclusionListPath>
<!-- This controls if we consume official binaries from MsQuic or if we use binaries published from dotnet/msquic repo.
Release branches should generally consume MsQuic release code, transport allows us to consume and test pre-released versions -->
<UseQuicTransportPackage Condition="'$(UseQuicTransportPackage)' == ''">true</UseQuicTransportPackage>
<UseQuicTransportPackage Condition="'$(UseQuicTransportPackage)' == ''">false</UseQuicTransportPackage>
</PropertyGroup>
<ItemGroup>
<AssemblyAttribute Include="System.Runtime.Versioning.RequiresPreviewFeaturesAttribute" />
......
......@@ -18,7 +18,7 @@ internal sealed unsafe partial class MsQuicApi
{
private static readonly Version s_minWindowsVersion = new Version(10, 0, 20145, 1000);
private static readonly Version s_minMsQuicVersion = new Version(2, 1);
private static readonly Version s_minMsQuicVersion = new Version(2, 2, 2);
private static readonly delegate* unmanaged[Cdecl]<uint, QUIC_API_TABLE**, int> MsQuicOpenVersion;
private static readonly delegate* unmanaged[Cdecl]<QUIC_API_TABLE*, void> MsQuicClose;
......
......@@ -151,6 +151,7 @@ internal enum QUIC_STREAM_OPEN_FLAGS
NONE = 0x0000,
UNIDIRECTIONAL = 0x0001,
ZERO_RTT = 0x0002,
DELAY_FC_UPDATES = 0x0004,
}
[System.Flags]
......
......@@ -515,6 +515,7 @@ private unsafe int HandleEventPeerStreamStarted(ref PEER_STREAM_STARTED_DATA dat
return QUIC_STATUS_SUCCESS;
}
data.Flags |= QUIC_STREAM_OPEN_FLAGS.DELAY_FC_UPDATES;
return QUIC_STATUS_SUCCESS;
}
private unsafe int HandleEventPeerCertificateReceived(ref PEER_CERTIFICATE_RECEIVED_DATA data)
......
......@@ -709,6 +709,32 @@ public async Task OpenStreamAsync_BlocksUntilAvailable(bool unidirectional)
await serverConnection.DisposeAsync();
}
[Fact]
public async Task OpenStreamAsync_BlocksUntilAvailable_PeerClosesWritingUnidirectional()
{
QuicListenerOptions listenerOptions = new QuicListenerOptions()
{
ListenEndPoint = new IPEndPoint(IPAddress.Loopback, 0),
ApplicationProtocols = new List<SslApplicationProtocol>() { ApplicationProtocol },
ConnectionOptionsCallback = (_, _, _) =>
{
var serverOptions = CreateQuicServerOptions();
serverOptions.MaxInboundBidirectionalStreams = 1;
serverOptions.MaxInboundUnidirectionalStreams = 1;
return ValueTask.FromResult(serverOptions);
}
};
(QuicConnection clientConnection, QuicConnection serverConnection) = await CreateConnectedQuicConnection(null, listenerOptions);
// Open one stream, second call should block
await using var stream = await clientConnection.OpenOutboundStreamAsync(QuicStreamType.Unidirectional);
await stream.WriteAsync(new byte[64*1024], completeWrites: true);
await Assert.ThrowsAsync<TimeoutException>(() => clientConnection.OpenOutboundStreamAsync(QuicStreamType.Unidirectional).AsTask().WaitAsync(TimeSpan.FromSeconds(1)));
await clientConnection.DisposeAsync();
await serverConnection.DisposeAsync();
}
[Theory]
[InlineData(false)]
[InlineData(true)]
......@@ -747,11 +773,24 @@ public async Task OpenStreamAsync_Canceled_Throws_OperationCanceledException(boo
// Close the streams, the waitTask should finish as a result.
await stream.DisposeAsync();
QuicStream newStream = await serverConnection.AcceptInboundStreamAsync();
await newStream.DisposeAsync();
// Drain all server streams.
while (true)
{
using var acceptCts = new CancellationTokenSource(TimeSpan.FromSeconds(0.5));
try
{
QuicStream serverStream = await serverConnection.AcceptInboundStreamAsync(acceptCts.Token);
await serverStream.DisposeAsync();
}
catch (OperationCanceledException)
{
// Token expired, no more streams in the server queue, exit the loop.
break;
}
}
// next call should work as intended
newStream = await OpenStreamAsync(clientConnection).AsTask().WaitAsync(TimeSpan.FromSeconds(10));
var newStream = await OpenStreamAsync(clientConnection).AsTask().WaitAsync(TimeSpan.FromSeconds(10));
await newStream.DisposeAsync();
await clientConnection.DisposeAsync();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册