Ejemplo n.º 1
0
        private async Task CloseTransportAsync()
        {
            await ExecuteAsync(async() =>
            {
                AddStatusMessage("Disconnecting...");

                var timeoutCancellationToken = _operationTimeout.ToCancellationToken();

                _connectionCts.Cancel();

                // Closes the transport
                await Transport.CloseAsync(timeoutCancellationToken);
                await _receiveTask.WithCancellation(timeoutCancellationToken);

                Transport.DisposeIfDisposable();
                Transport = null;
            });
        }