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