Ejemplo n.º 1
0
        public async Task RegisterRouteAsync(RouteRegistration routeRegistration, CancellationToken cancellation)
        {
            try
            {
                using (var guard = await _disposeHelper.GuardDisposalAsync(cancellation))
                {
                    var localEndPoint = await GetLocalEndPointAsync(cancellation);

                    await _routeManager.AddRouteAsync(localEndPoint, routeRegistration, cancellation);
                }
            }
            catch (OperationCanceledException) when(_disposeHelper.IsDisposed)
            {
                throw new ObjectDisposedException(GetType().FullName);
            }
        }