Add Id to ConnectionInfo (#828)

This commit is contained in:
Kristian Hellang 2017-05-10 23:54:05 +02:00 committed by Chris R
parent 412e4de2a5
commit f5107596a5
2 changed files with 14 additions and 2 deletions

View File

@ -10,6 +10,11 @@ namespace Microsoft.AspNetCore.Http
{ {
public abstract class ConnectionInfo public abstract class ConnectionInfo
{ {
/// <summary>
/// Gets or sets a unique identifier to represent this connection.
/// </summary>
public abstract string Id { get; set; }
public abstract IPAddress RemoteIpAddress { get; set; } public abstract IPAddress RemoteIpAddress { get; set; }
public abstract int RemotePort { get; set; } public abstract int RemotePort { get; set; }
@ -22,4 +27,4 @@ namespace Microsoft.AspNetCore.Http
public abstract Task<X509Certificate2> GetClientCertificateAsync(CancellationToken cancellationToken = new CancellationToken()); public abstract Task<X509Certificate2> GetClientCertificateAsync(CancellationToken cancellationToken = new CancellationToken());
} }
} }

View File

@ -39,6 +39,13 @@ namespace Microsoft.AspNetCore.Http.Internal
private ITlsConnectionFeature TlsConnectionFeature=> private ITlsConnectionFeature TlsConnectionFeature=>
_features.Fetch(ref _features.Cache.TlsConnection, _newTlsConnectionFeature); _features.Fetch(ref _features.Cache.TlsConnection, _newTlsConnectionFeature);
/// <inheritdoc />
public override string Id
{
get { return HttpConnectionFeature.ConnectionId; }
set { HttpConnectionFeature.ConnectionId = value; }
}
public override IPAddress RemoteIpAddress public override IPAddress RemoteIpAddress
{ {
get { return HttpConnectionFeature.RemoteIpAddress; } get { return HttpConnectionFeature.RemoteIpAddress; }
@ -80,4 +87,4 @@ namespace Microsoft.AspNetCore.Http.Internal
public ITlsConnectionFeature TlsConnection; public ITlsConnectionFeature TlsConnection;
} }
} }
} }