Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ HandleHttp11Downgrade()

async Task System.Net.Http.HttpConnectionPool.HandleHttp11Downgrade ( HttpRequestMessage request,
Socket socket,
Stream stream,
TransportContext transportContext,
CancellationToken cancellationToken )
inlineprivate

Definition at line 475 of file HttpConnectionPool.cs.

476 {
477 if (System.Net.NetEventSource.Log.IsEnabled())
478 {
479 Trace("Server does not support HTTP2; disabling HTTP2 use and proceeding with HTTP/1.1 connection", "HandleHttp11Downgrade");
480 }
481 bool flag = true;
482 lock (SyncObj)
483 {
484 _http2Enabled = false;
487 while (_http2RequestQueue.TryDequeueNextRequest(null))
488 {
489 }
491 {
494 }
495 else
496 {
497 flag = false;
498 }
499 }
500 if (!flag)
501 {
502 if (System.Net.NetEventSource.Log.IsEnabled())
503 {
504 Trace("Discarding downgraded HTTP/1.1 connection because HTTP/1.1 connection limit is exceeded", "HandleHttp11Downgrade");
505 }
506 stream.Dispose();
507 }
508 HttpConnection connection;
509 try
510 {
512 }
513 catch (OperationCanceledException ex) when (ex.CancellationToken == cancellationToken)
514 {
516 return;
517 }
518 catch (Exception e)
519 {
521 return;
522 }
524 }
RequestQueue< Http2Connection > _http2RequestQueue
static Exception CreateConnectTimeoutException(OperationCanceledException oce)
void ReturnHttp11Connection(HttpConnection connection, bool isNewConnection=false)
void Trace(string message, [CallerMemberName] string memberName=null)
async ValueTask< HttpConnection > ConstructHttp11ConnectionAsync(bool async, Socket socket, Stream stream, TransportContext transportContext, HttpRequestMessage request, CancellationToken cancellationToken)
static readonly System.Net.NetEventSource Log

References System.Net.Http.HttpConnectionPool._associatedHttp11ConnectionCount, System.Net.Http.HttpConnectionPool._associatedHttp2ConnectionCount, System.Net.Http.HttpConnectionPool._http2Enabled, System.Net.Http.HttpConnectionPool._http2RequestQueue, System.Net.Http.HttpConnectionPool._maxHttp11Connections, System.Net.Http.HttpConnectionPool._pendingHttp11ConnectionCount, System.Net.Http.HttpConnectionPool._pendingHttp2Connection, System.cancellationToken, System.Net.Http.HttpConnectionPool.ConstructHttp11ConnectionAsync(), System.Net.Http.HttpConnectionPool.CreateConnectTimeoutException(), System.Net.Http.HttpConnectionPool.HandleHttp11ConnectionFailure(), System.Net.NetEventSource.Log, System.Net.Http.HttpConnectionPool.ReturnHttp11Connection(), System.stream, System.Net.Http.HttpConnectionPool.SyncObj, and System.Net.Http.HttpConnectionPool.Trace().

Referenced by System.Net.Http.HttpConnectionPool.AddHttp2ConnectionAsync().