Example #1
0
        /// <inheritdoc/>
        public async Task StopAsync(CancellationToken token)
        {
            if (!isRunning)
            {
                return;
            }

            tokenSource.Cancel();
            await connection.StopAsync(token);

            isRunning = false;
        }
Example #2
0
        public async ValueTask StopAsync()
        {
            if (!_isRunning)
            {
                return;
            }

            _connection.Dispatch -= Dispatch;
            _tokenSource.Cancel();

            await _connection.StopAsync();

            _isRunning = false;
        }