1 instantiation of HttpConnectionContext
Microsoft.AspNetCore.Http.Connections (1)
Internal\HttpConnectionManager.cs (1)
81var connection = new HttpConnectionContext(id, connectionToken, _connectionLogger, metricsContext, pair.Application, pair.Transport, options, useStatefulReconnect);
126 references to HttpConnectionContext
Microsoft.AspNetCore.Http.Connections (35)
Internal\HttpConnectionDispatcher.cs (18)
67HttpConnectionContext? connectionContext = null; 135var connection = await GetConnectionAsync(context); 165HttpConnectionContext? connection; 328private async Task DoPersistentConnection(HttpConnectionContext connection) 375HttpConnectionContext? connection = null; 451var connection = await GetConnectionAsync(context); 544var connection = await GetConnectionAsync(context); 570private async Task<bool> EnsureConnectionStateAsync(HttpConnectionContext connection, HttpContext context, HttpTransportType transportType, HttpTransportType supportedTransports, ConnectionLogScope logScope) 583case HttpConnectionContext.SetTransportState.Success: 586case HttpConnectionContext.SetTransportState.AlreadyActive: 594case HttpConnectionContext.SetTransportState.CannotChange: 662private static void UpdateExpiration(HttpConnectionContext connection, HttpContext context) 709private static void CloneHttpContext(HttpContext context, HttpConnectionContext connection) 773private async Task<HttpConnectionContext?> GetConnectionAsync(HttpContext context) 787if (!_manager.TryGetConnection(connectionToken.ToString(), out var connection)) 800private async Task<HttpConnectionContext?> GetOrCreateConnectionAsync(HttpContext context, HttpConnectionDispatcherOptions options) 803HttpConnectionContext? connection; 822private HttpConnectionContext CreateConnection(HttpConnectionDispatcherOptions options, int clientProtocolVersion = 0, bool useStatefulReconnect = false)
Internal\HttpConnectionManager.cs (11)
22private readonly ConcurrentDictionary<string, HttpConnectionContext> _connections = 23new ConcurrentDictionary<string, HttpConnectionContext>(StringComparer.Ordinal); 26private readonly ILogger<HttpConnectionContext> _connectionLogger; 33_connectionLogger = loggerFactory.CreateLogger<HttpConnectionContext>(); 49internal bool TryGetConnection(string id, [NotNullWhen(true)] out HttpConnectionContext? connection) 54internal HttpConnectionContext CreateConnection() 63internal HttpConnectionContext CreateConnection(HttpConnectionDispatcherOptions options, int negotiateVersion = 0, bool useStatefulReconnect = false) 81var connection = new HttpConnectionContext(id, connectionToken, _connectionLogger, metricsContext, pair.Application, pair.Transport, options, useStatefulReconnect); 91if (_connections.TryRemove(id, out var connection)) 149var connection = c.Value; 203internal async Task DisposeAndRemoveAsync(HttpConnectionContext connection, bool closeGracefully, HttpConnectionStopStatus status)
Internal\Transports\LongPollingServerTransport.cs (2)
15private readonly HttpConnectionContext? _connection; 21public LongPollingServerTransport(CancellationToken timeoutToken, PipeReader application, ILoggerFactory loggerFactory, HttpConnectionContext? connection)
Internal\Transports\ServerSentEventsServerTransport.cs (2)
15private readonly HttpConnectionContext? _connection; 21public ServerSentEventsServerTransport(PipeReader application, string connectionId, HttpConnectionContext? connection, ILoggerFactory loggerFactory)
Internal\Transports\WebSocketsServerTransport.cs (2)
17private readonly HttpConnectionContext _connection; 23public WebSocketsServerTransport(WebSocketOptions options, IDuplexPipe application, HttpConnectionContext connection, ILoggerFactory loggerFactory)
Microsoft.AspNetCore.Http.Connections.Tests (91)
HttpConnectionDispatcherTests.cs (70)
98Assert.True(manager.TryGetConnection(connectionToken, out var connectionContext)); 125Assert.True(manager.TryGetConnection(connectionToken, out var connection)); 209var connection = manager.CreateConnection(options); 375var connection = manager.CreateConnection(); 413var connection = manager.CreateConnection(); 452var connection = manager.CreateConnection(); 514var connection = manager.CreateConnection(); 579var connection = manager.CreateConnection(); 629var connection = manager.CreateConnection(); 714var connection = manager.CreateConnection(); 748var connection = manager.CreateConnection(); 890var connection = manager.CreateConnection(); 1002var connection = manager.CreateConnection(); 1036var connection = manager.CreateConnection(); 1062var connection = manager.CreateConnection(); 1099var connection = manager.CreateConnection(); 1135var connection = manager.CreateConnection(); 1185var connection = manager.CreateConnection(); 1282var connection = manager.CreateConnection(); 1311Assert.False(manager.TryGetConnection(connection.ConnectionId, out var _)); 1323var connection = manager.CreateConnection(); 1350Assert.False(manager.TryGetConnection(connection.ConnectionId, out var _)); 1367var connection = manager.CreateConnection(); 1394Assert.False(manager.TryGetConnection(connection.ConnectionId, out var _)); 1405var connection = manager.CreateConnection(); 1435var connection = manager.CreateConnection(); 1480var connection = manager.CreateConnection(); 1545var connection = manager.CreateConnection(); 1609var connection = manager.CreateConnection(); 1640var connection = manager.CreateConnection(); 1675var connection = manager.CreateConnection(); 1709var connection = manager.CreateConnection(); 1751var connection = manager.CreateConnection(); 1798var connection = manager.CreateConnection(); 1830var connection = manager.CreateConnection(); 1882var connection = manager.CreateConnection(); 1937var connection = manager.CreateConnection(); 1982var connection = manager.CreateConnection(); 2014var connection = manager.CreateConnection(); 2055var connection = manager.CreateConnection(); 2108var connection = manager.CreateConnection(); 2161var connection = manager.CreateConnection(options); 2213var connection = manager.CreateConnection(); 2305Assert.True(manager.TryGetConnection(negotiateResponse["connectionToken"].ToString(), out var connection)); 2334Assert.True(manager.TryGetConnection(negotiateResponse["connectionToken"].ToString(), out var connection)); 2363Assert.True(manager.TryGetConnection(negotiateResponse["connectionToken"].ToString(), out var connection)); 2379var connection = manager.CreateConnection(options, negotiateVersion: 1, useStatefulReconnect: true); 2454var connection = manager.CreateConnection(options, negotiateVersion: 1, useStatefulReconnect: true); 2549var connection = manager.CreateConnection(options); 2611var connection = manager.CreateConnection(options); 2668var connection = manager.CreateConnection(options); 2727var connection = manager.CreateConnection(); 2751Assert.False(manager.TryGetConnection(connection.ConnectionToken, out var _)); 2767var connection = manager.CreateConnection(options); 2819var connection = manager.CreateConnection(); 2845var connection = manager.CreateConnection(); 2875var connection = manager.CreateConnection(); 2923var connection = manager.CreateConnection(); 2956var connection = manager.CreateConnection(); 3007var connection = manager.CreateConnection(); 3062var connection = manager.CreateConnection(); 3109var connection = manager.CreateConnection(); 3147var connection = manager.CreateConnection(options); 3280Assert.True(manager.TryGetConnection(negotiateResponse.ConnectionToken, out var context)); 3342Assert.True(manager.TryGetConnection(negotiateResponse.ConnectionToken, out var context)); 3442Assert.True(manager.TryGetConnection(negotiateResponse.ConnectionToken, out var context)); 3481Assert.True(manager.TryGetConnection(negotiateResponse.ConnectionToken, out var context)); 3555Assert.True(manager.TryGetConnection(negotiateResponse.ConnectionToken, out var context)); 3571var connection = manager.CreateConnection(options); 3685var connection = manager.CreateConnection();
HttpConnectionManagerTests.cs (21)
48var connection = connectionManager.CreateConnection(); 80var connection = connectionManager.CreateConnection(); 148var connection = connectionManager.CreateConnection(); 152Assert.True(connectionManager.TryGetConnection(connection.ConnectionToken, out var newConnection)); 163var connection = connectionManager.CreateConnection(); 170Assert.True(connectionManager.TryGetConnection(connection.ConnectionToken, out var newConnection)); 182var connection = connectionManager.CreateConnection(); 189Assert.True(connectionManager.TryGetConnection(connection.ConnectionToken, out var newConnection)); 204var connection = connectionManager.CreateConnection(new(), negotiateVersion: 0); 211Assert.True(connectionManager.TryGetConnection(connection.ConnectionToken, out var newConnection)); 225var connection = connectionManager.CreateConnection(new(), negotiateVersion: 1); 232Assert.True(connectionManager.TryGetConnection(connection.ConnectionToken, out var newConnection)); 233Assert.False(connectionManager.TryGetConnection(connection.ConnectionId, out var _)); 247var connection = connectionManager.CreateConnection(); 289var connection = connectionManager.CreateConnection(); 312var connection = connectionManager.CreateConnection(); 339var connection = connectionManager.CreateConnection(); 363var connection = connectionManager.CreateConnection(); 379var connection = connectionManager.CreateConnection(); 400var connection = connectionManager.CreateConnection(); 419var connection = connectionManager.CreateConnection();