예제 #1
0
        private void OnAccountLocked(object sender, AccountLockedEventArgs e)
        {
            if (e.Address != _consumerAddress)
            {
                return;
            }

            _consumerNotifier.SendConsumerAccountLockedAsync(e.Address);
            if (_logger.IsInfo)
            {
                _logger.Info($"Locked a consumer account: '{e.Address}', all of the existing data streams will be disabled.");
            }

            var sessions           = _sessionService.GetAllActive();
            var disableStreamTasks = from session in sessions
                                     from client in session.Clients
                                     select _dataStreamService.DisableDataStreamAsync(session.DepositId, client.Id);

            Task.WhenAll(disableStreamTasks).ContinueWith(t =>
            {
                if (t.IsFaulted && _logger.IsError)
                {
                    _logger.Error("Disabling the data stream has failed.", t.Exception);
                }
            });
        }
예제 #2
0
        public async Task disable_data_stream_should_fail_for_missing_session()
        {
            var depositId = Keccak.Zero;
            var client    = "test";

            var result = await _dataStreamService.DisableDataStreamAsync(depositId, client);

            result.Should().BeNull();
            _providerPeer.DidNotReceive().SendDisableDataStream(depositId, client);
            _sessionService.Received(1).GetActive(depositId);
        }
예제 #3
0
 public Task <Keccak> DisableDataStreamAsync(Keccak depositId, string client)
 => _dataStreamService.DisableDataStreamAsync(depositId, client);