예제 #1
0
        public async Task StopAsync(ExitType exitType)
        {
            if (_logger.IsInfo) _logger.Info("Shutting down...");
            _runnerCancellation.Cancel();

            if (_logger.IsInfo) _logger.Info("Stopping rlpx peer...");
            var rlpxPeerTask = _rlpxPeer?.Shutdown() ?? Task.CompletedTask;

            if (_logger.IsInfo) _logger.Info("Stopping peer manager...");
            var peerManagerTask = _peerManager?.StopAsync(exitType) ?? Task.CompletedTask;

            if (_logger.IsInfo) _logger.Info("Stopping sync manager...");
            var syncManagerTask = _syncManager?.StopAsync() ?? Task.CompletedTask;

            if (_logger.IsInfo) _logger.Info("Stopping block producer...");
            var blockProducerTask = _blockProducer?.StopAsync() ?? Task.CompletedTask;
            
            if (_logger.IsInfo) _logger.Info("Stopping blockchain processor...");
            var blockchainProcessorTask = (_blockchainProcessor?.StopAsync() ?? Task.CompletedTask);

            if (_logger.IsInfo) _logger.Info("Stopping discovery app...");
            var discoveryStopTask = _discoveryApp?.StopAsync() ?? Task.CompletedTask;

            await Task.WhenAll(discoveryStopTask, rlpxPeerTask, peerManagerTask, syncManagerTask, blockchainProcessorTask, blockProducerTask);

            if (_logger.IsInfo) _logger.Info("Closing DBs...");
            _dbProvider.Dispose();
            if (_logger.IsInfo) _logger.Info("Ethereum shutdown complete... please wait for all components to close");
        }
예제 #2
0
 public async Task StopAsync()
 {
     _logger.Info("Shutting down...");
     _runnerCancellation.Cancel();
     _logger.Info("Stopping sync manager...");
     await(_syncManager?.StopAsync() ?? Task.CompletedTask);
     _logger.Info("Stopping blockchain processor...");
     await(_blockchainProcessor?.StopAsync() ?? Task.CompletedTask);
     _logger.Info("Stopping local peer...");
     await(_localPeer?.Shutdown() ?? Task.CompletedTask);
     _logger.Info("Goodbye...");
 }
예제 #3
0
        public async Task StopAsync()
        {
            if (_logger.IsInfo)
            {
                _logger.Info("Shutting down...");
            }
            _runnerCancellation.Cancel();

            if (_logger.IsInfo)
            {
                _logger.Info("Stopping rlpx peer...");
            }
            var rlpxPeerTask = _rlpxPeer?.Shutdown() ?? Task.CompletedTask;

            if (_logger.IsInfo)
            {
                _logger.Info("Stopping sesison monitor...");
            }
            _sessionMonitor?.Stop();

            if (_logger.IsInfo)
            {
                _logger.Info("Stopping peer manager...");
            }
            var peerManagerTask = _peerManager?.StopAsync() ?? Task.CompletedTask;

            if (_logger.IsInfo)
            {
                _logger.Info("Stopping synchronizer...");
            }
            var synchronizerTask = (_synchronizer?.StopAsync() ?? Task.CompletedTask)
                                   .ContinueWith(t => _synchronizer?.Dispose());

            if (_logger.IsInfo)
            {
                _logger.Info("Stopping sync peer pool...");
            }
            var peerPoolTask = _syncPeerPool?.StopAsync() ?? Task.CompletedTask;

            if (_logger.IsInfo)
            {
                _logger.Info("Stopping block producer...");
            }
            var blockProducerTask = _blockProducer?.StopAsync() ?? Task.CompletedTask;

            if (_logger.IsInfo)
            {
                _logger.Info("Stopping blockchain processor...");
            }
            var blockchainProcessorTask = (_blockchainProcessor?.StopAsync() ?? Task.CompletedTask);

            if (_logger.IsInfo)
            {
                _logger.Info("Stopping discovery app...");
            }
            var discoveryStopTask = _discoveryApp?.StopAsync() ?? Task.CompletedTask;

            await Task.WhenAll(discoveryStopTask, rlpxPeerTask, peerManagerTask, synchronizerTask, peerPoolTask, blockchainProcessorTask, blockProducerTask);

            if (_logger.IsInfo)
            {
                _logger.Info("Closing DBs...");
            }
            _dbProvider.Dispose();
            if (_logger.IsInfo)
            {
                _logger.Info("Ethereum shutdown complete... please wait for all components to close");
            }
        }