Skip to content

Commit a2ad4f0

Browse files
authored
Merge pull request #90173 from vseanreesermsft/internal-merge-7.0-2023-08-08-1042
Merging internal commits for release/7.0
2 parents 7290ca6 + a1f8375 commit a2ad4f0

6 files changed

Lines changed: 48 additions & 5 deletions

File tree

eng/Versions.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@
179179
<!-- ICU -->
180180
<MicrosoftNETCoreRuntimeICUTransportVersion>7.0.0-rtm.23315.2</MicrosoftNETCoreRuntimeICUTransportVersion>
181181
<!-- MsQuic -->
182-
<MicrosoftNativeQuicMsQuicVersion>2.1.1</MicrosoftNativeQuicMsQuicVersion>
182+
<MicrosoftNativeQuicMsQuicVersion>2.2.2</MicrosoftNativeQuicMsQuicVersion>
183183
<SystemNetMsQuicTransportVersion>7.0.0-alpha.1.22459.1</SystemNetMsQuicTransportVersion>
184184
<!-- Mono LLVM -->
185185
<runtimelinuxarm64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>11.1.0-alpha.1.23115.1</runtimelinuxarm64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>

src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ internal sealed unsafe partial class MsQuicApi
1818
{
1919
private static readonly Version MinWindowsVersion = new Version(10, 0, 20145, 1000);
2020

21-
private static readonly Version MinMsQuicVersion = new Version(2, 1);
21+
private static readonly Version MinMsQuicVersion = new Version(2, 2, 2);
2222

2323
private static readonly delegate* unmanaged[Cdecl]<uint, QUIC_API_TABLE**, int> MsQuicOpenVersion;
2424
private static readonly delegate* unmanaged[Cdecl]<QUIC_API_TABLE*, void> MsQuicClose;

src/libraries/System.Net.Quic/src/System/Net/Quic/Interop/msquic_generated.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ internal enum QUIC_STREAM_OPEN_FLAGS
129129
NONE = 0x0000,
130130
UNIDIRECTIONAL = 0x0001,
131131
ZERO_RTT = 0x0002,
132+
DELAY_FC_UPDATES = 0x0004,
132133
}
133134

134135
[System.Flags]

src/libraries/System.Net.Quic/src/System/Net/Quic/QuicConnection.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,8 @@ private unsafe int HandleEventPeerStreamStarted(ref PEER_STREAM_STARTED_DATA dat
500500
stream.Dispose();
501501
return QUIC_STATUS_SUCCESS;
502502
}
503+
504+
data.Flags |= QUIC_STREAM_OPEN_FLAGS.DELAY_FC_UPDATES;
503505
return QUIC_STATUS_SUCCESS;
504506
}
505507
private unsafe int HandleEventPeerCertificateReceived(ref PEER_CERTIFICATE_RECEIVED_DATA data)

src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,32 @@ ValueTask<QuicStream> OpenStreamAsync(QuicConnection connection) => unidirection
584584
await serverConnection.DisposeAsync();
585585
}
586586

587+
[Fact]
588+
public async Task OpenStreamAsync_BlocksUntilAvailable_PeerClosesWritingUnidirectional()
589+
{
590+
QuicListenerOptions listenerOptions = new QuicListenerOptions()
591+
{
592+
ListenEndPoint = new IPEndPoint(IPAddress.Loopback, 0),
593+
ApplicationProtocols = new List<SslApplicationProtocol>() { ApplicationProtocol },
594+
ConnectionOptionsCallback = (_, _, _) =>
595+
{
596+
var serverOptions = CreateQuicServerOptions();
597+
serverOptions.MaxInboundBidirectionalStreams = 1;
598+
serverOptions.MaxInboundUnidirectionalStreams = 1;
599+
return ValueTask.FromResult(serverOptions);
600+
}
601+
};
602+
(QuicConnection clientConnection, QuicConnection serverConnection) = await CreateConnectedQuicConnection(null, listenerOptions);
603+
604+
// Open one stream, second call should block
605+
await using var stream = await clientConnection.OpenOutboundStreamAsync(QuicStreamType.Unidirectional);
606+
await stream.WriteAsync(new byte[64*1024], completeWrites: true);
607+
await Assert.ThrowsAsync<TimeoutException>(() => clientConnection.OpenOutboundStreamAsync(QuicStreamType.Unidirectional).AsTask().WaitAsync(TimeSpan.FromSeconds(1)));
608+
609+
await clientConnection.DisposeAsync();
610+
await serverConnection.DisposeAsync();
611+
}
612+
587613
[Theory]
588614
[InlineData(false)]
589615
[InlineData(true)]
@@ -622,11 +648,24 @@ ValueTask<QuicStream> OpenStreamAsync(QuicConnection connection, CancellationTok
622648

623649
// Close the streams, the waitTask should finish as a result.
624650
await stream.DisposeAsync();
625-
QuicStream newStream = await serverConnection.AcceptInboundStreamAsync();
626-
await newStream.DisposeAsync();
651+
// Drain all server streams.
652+
while (true)
653+
{
654+
using var acceptCts = new CancellationTokenSource(TimeSpan.FromSeconds(0.5));
655+
try
656+
{
657+
QuicStream serverStream = await serverConnection.AcceptInboundStreamAsync(acceptCts.Token);
658+
await serverStream.DisposeAsync();
659+
}
660+
catch (OperationCanceledException)
661+
{
662+
// Token expired, no more streams in the server queue, exit the loop.
663+
break;
664+
}
665+
}
627666

628667
// next call should work as intended
629-
newStream = await OpenStreamAsync(clientConnection).AsTask().WaitAsync(TimeSpan.FromSeconds(10));
668+
var newStream = await OpenStreamAsync(clientConnection).AsTask().WaitAsync(TimeSpan.FromSeconds(10));
630669
await newStream.DisposeAsync();
631670

632671
await clientConnection.DisposeAsync();

src/libraries/System.Net.Quic/tests/FunctionalTests/System.Net.Quic.Functional.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<IncludeRemoteExecutor>true</IncludeRemoteExecutor>
55
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix</TargetFrameworks>
66
<EnablePreviewFeatures>true</EnablePreviewFeatures>
7+
<NoWarn>CA2252</NoWarn>
78
</PropertyGroup>
89
<ItemGroup>
910
<RdXmlFile Include="default.rd.xml" />

0 commit comments

Comments
 (0)