@@ -25,11 +25,6 @@ internal sealed partial class HttpConnectionPool
25
25
/// <summary>The time, in milliseconds, that an authority should remain in <see cref="_altSvcBlocklist"/>.</summary>
26
26
private const int AltSvcBlocklistTimeoutInMilliseconds = 10 * 60 * 1000 ;
27
27
28
- [ SupportedOSPlatformGuard ( "linux" ) ]
29
- [ SupportedOSPlatformGuard ( "macOS" ) ]
30
- [ SupportedOSPlatformGuard ( "windows" ) ]
31
- internal static bool IsHttp3Supported ( ) => ( OperatingSystem . IsLinux ( ) && ! OperatingSystem . IsAndroid ( ) ) || OperatingSystem . IsWindows ( ) || OperatingSystem . IsMacOS ( ) ;
32
-
33
28
/// <summary>List of available HTTP/3 connections stored in the pool.</summary>
34
29
private List < Http3Connection > ? _availableHttp3Connections ;
35
30
/// <summary>The number of HTTP/3 connections associated with the pool, including in use, available, and pending.</summary>
@@ -67,7 +62,7 @@ internal sealed partial class HttpConnectionPool
67
62
[ SupportedOSPlatform ( "macos" ) ]
68
63
private async ValueTask < HttpResponseMessage ? > TrySendUsingHttp3Async ( HttpRequestMessage request , CancellationToken cancellationToken )
69
64
{
70
- Debug . Assert ( IsHttp3Supported ( ) ) ;
65
+ Debug . Assert ( GlobalHttpSettings . SocketsHttpHandler . AllowHttp3 ) ;
71
66
72
67
Debug . Assert ( _kind == HttpConnectionKind . Https ) ;
73
68
Debug . Assert ( _http3Enabled ) ;
@@ -135,7 +130,7 @@ internal sealed partial class HttpConnectionPool
135
130
[ SupportedOSPlatform ( "macos" ) ]
136
131
private bool TryGetPooledHttp3Connection ( HttpRequestMessage request , [ NotNullWhen ( true ) ] out Http3Connection ? connection , [ NotNullWhen ( false ) ] out HttpConnectionWaiter < Http3Connection ? > ? waiter , out bool streamAvailable )
137
132
{
138
- Debug . Assert ( IsHttp3Supported ( ) ) ;
133
+ Debug . Assert ( GlobalHttpSettings . SocketsHttpHandler . AllowHttp3 ) ;
139
134
140
135
// Look for a usable connection.
141
136
while ( true )
@@ -210,7 +205,7 @@ private bool TryGetPooledHttp3Connection(HttpRequestMessage request, [NotNullWhe
210
205
[ SupportedOSPlatform ( "macos" ) ]
211
206
private void CheckForHttp3ConnectionInjection ( )
212
207
{
213
- Debug . Assert ( IsHttp3Supported ( ) ) ;
208
+ Debug . Assert ( GlobalHttpSettings . SocketsHttpHandler . AllowHttp3 ) ;
214
209
215
210
Debug . Assert ( HasSyncObjLock ) ;
216
211
@@ -249,7 +244,7 @@ private void CheckForHttp3ConnectionInjection()
249
244
[ SupportedOSPlatform ( "macos" ) ]
250
245
private async Task InjectNewHttp3ConnectionAsync ( RequestQueue < Http3Connection ? > . QueueItem queueItem )
251
246
{
252
- Debug . Assert ( IsHttp3Supported ( ) ) ;
247
+ Debug . Assert ( GlobalHttpSettings . SocketsHttpHandler . AllowHttp3 ) ;
253
248
254
249
if ( NetEventSource . Log . IsEnabled ( ) ) Trace ( "Creating new HTTP/3 connection for pool." ) ;
255
250
@@ -332,7 +327,7 @@ private async Task InjectNewHttp3ConnectionAsync(RequestQueue<Http3Connection?>.
332
327
[ SupportedOSPlatform ( "macos" ) ]
333
328
private void HandleHttp3ConnectionFailure ( HttpConnectionWaiter < Http3Connection ? > requestWaiter , Exception ? e )
334
329
{
335
- Debug . Assert ( IsHttp3Supported ( ) ) ;
330
+ Debug . Assert ( GlobalHttpSettings . SocketsHttpHandler . AllowHttp3 ) ;
336
331
337
332
if ( NetEventSource . Log . IsEnabled ( ) ) Trace ( $ "HTTP3 connection failed: { e } ") ;
338
333
@@ -363,7 +358,7 @@ private void HandleHttp3ConnectionFailure(HttpConnectionWaiter<Http3Connection?>
363
358
[ SupportedOSPlatform ( "macos" ) ]
364
359
private void ReturnHttp3Connection ( Http3Connection connection , bool isNewConnection , HttpConnectionWaiter < Http3Connection ? > ? initialRequestWaiter = null )
365
360
{
366
- Debug . Assert ( IsHttp3Supported ( ) ) ;
361
+ Debug . Assert ( GlobalHttpSettings . SocketsHttpHandler . AllowHttp3 ) ;
367
362
368
363
if ( NetEventSource . Log . IsEnabled ( ) ) connection . Trace ( $ "{ nameof ( isNewConnection ) } ={ isNewConnection } ") ;
369
364
@@ -485,7 +480,7 @@ private void ReturnHttp3Connection(Http3Connection connection, bool isNewConnect
485
480
[ SupportedOSPlatform ( "macos" ) ]
486
481
private void DisableHttp3Connection ( Http3Connection connection )
487
482
{
488
- Debug . Assert ( IsHttp3Supported ( ) ) ;
483
+ Debug . Assert ( GlobalHttpSettings . SocketsHttpHandler . AllowHttp3 ) ;
489
484
490
485
if ( NetEventSource . Log . IsEnabled ( ) ) connection . Trace ( "" ) ;
491
486
@@ -528,7 +523,7 @@ async Task DisableHttp3ConnectionAsync(Http3Connection connection)
528
523
[ SupportedOSPlatform ( "macos" ) ]
529
524
public void InvalidateHttp3Connection ( Http3Connection connection , bool dispose = true )
530
525
{
531
- Debug . Assert ( IsHttp3Supported ( ) ) ;
526
+ Debug . Assert ( GlobalHttpSettings . SocketsHttpHandler . AllowHttp3 ) ;
532
527
533
528
if ( NetEventSource . Log . IsEnabled ( ) ) connection . Trace ( "" ) ;
534
529
@@ -564,7 +559,7 @@ public void InvalidateHttp3Connection(Http3Connection connection, bool dispose =
564
559
[ SupportedOSPlatform ( "macos" ) ]
565
560
private static int ScavengeHttp3ConnectionList ( List < Http3Connection > list , ref List < HttpConnectionBase > ? toDispose , long nowTicks , TimeSpan pooledConnectionLifetime , TimeSpan pooledConnectionIdleTimeout )
566
561
{
567
- Debug . Assert ( IsHttp3Supported ( ) ) ;
562
+ Debug . Assert ( GlobalHttpSettings . SocketsHttpHandler . AllowHttp3 ) ;
568
563
569
564
int freeIndex = 0 ;
570
565
while ( freeIndex < list . Count && list [ freeIndex ] . IsUsable ( nowTicks , pooledConnectionLifetime , pooledConnectionIdleTimeout ) )
0 commit comments