// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using Microsoft.AspNetCore.Connections; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure { public class ConnectionReference { private readonly WeakReference _weakReference; public ConnectionReference(KestrelConnection connection) { _weakReference = new WeakReference(connection); ConnectionId = connection.TransportConnection.ConnectionId; } public string ConnectionId { get; } public bool TryGetConnection(out KestrelConnection connection) { return _weakReference.TryGetTarget(out connection); } } }