public RelayTunnel Create(HybridConnectionStream stream, ILocalDataChannelFactory localFactory) { var tunnel = new RelayTunnel(_log, _metrics, stream, localFactory, OnTunnelCompleted); _tunnels[tunnel] = tunnel; return(tunnel); }
private Task OnTunnelCompleted(RelayTunnel tunnel) { if (_tunnels.TryRemove(tunnel, out _)) { tunnel.IgnoreException(x => x.Dispose()); } return(Task.CompletedTask); }