Example #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");
        }
Example #2
0
        public async Task StopAsync()
        {
            _logger.Info("Shutting down...");
            _runnerCancellation.Cancel();

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

            // await rlpxPeerTask;

            _logger.Debug("Stopping peer manager...");
            var peerManagerTask = (_peerManager?.StopAsync() ?? Task.CompletedTask);

            //await peerManagerTask;

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

            //await syncManagerTask;

            _logger.Debug("Stopping blockchain processor...");
            var blockchainProcessorTask = (_blockchainProcessor?.StopAsync() ?? Task.CompletedTask);

            //await blockchainProcessorTask;

            _logger.Debug("Stopping discovery app...");
            var discoveryStopTask = _discoveryApp?.StopAsync() ?? Task.CompletedTask;
            //await discoveryStopTask;

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

            _logger.Info("Goodbye...");
        }
Example #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");
            }
        }
Example #4
0
 private static void Stop()
 {
     _discoveryApp.StopAsync();
 }