예제 #1
0
        public static async Task DisposeAsync()
        {
            CancelWalletServiceInitialization?.Cancel();

            WalletService?.Dispose();
            Logger.LogInfo($"{nameof(WalletService)} is stopped.", nameof(Global));

            UpdateChecker?.Dispose();
            Logger.LogInfo($"{nameof(UpdateChecker)} is stopped.", nameof(Global));

            IndexDownloader?.Dispose();
            Logger.LogInfo($"{nameof(IndexDownloader)} is stopped.", nameof(Global));

            Directory.CreateDirectory(Path.GetDirectoryName(AddressManagerFilePath));
            AddressManager?.SavePeerFile(AddressManagerFilePath, Config.Network);
            Logger.LogInfo($"{nameof(AddressManager)} is saved to `{AddressManagerFilePath}`.", nameof(Global));

            Nodes?.Dispose();
            Logger.LogInfo($"{nameof(Nodes)} are disposed.", nameof(Global));

            if (RegTestMemPoolServingNode != null)
            {
                RegTestMemPoolServingNode.Disconnect();
                Logger.LogInfo($"{nameof(RegTestMemPoolServingNode)} is disposed.", nameof(Global));
            }

            if (ChaumianClient != null)
            {
                await ChaumianClient.StopAsync();
            }
            Logger.LogInfo($"{nameof(ChaumianClient)} is stopped.", nameof(Global));
        }
예제 #2
0
        public static async Task DisposeAsync()
        {
            try
            {
                await DisposeInWalletDependentServicesAsync();

                UpdateChecker?.Dispose();
                Logger.LogInfo($"{nameof(UpdateChecker)} is stopped.", nameof(Global));

                IndexDownloader?.Dispose();
                Logger.LogInfo($"{nameof(IndexDownloader)} is stopped.", nameof(Global));

                IoHelpers.EnsureContainingDirectoryExists(AddressManagerFilePath);
                AddressManager?.SavePeerFile(AddressManagerFilePath, Config.Network);
                Logger.LogInfo($"{nameof(AddressManager)} is saved to `{AddressManagerFilePath}`.", nameof(Global));

                Nodes?.Dispose();
                Logger.LogInfo($"{nameof(Nodes)} are disposed.", nameof(Global));

                if (!(RegTestMemPoolServingNode is null))
                {
                    RegTestMemPoolServingNode.Disconnect();
                    Logger.LogInfo($"{nameof(RegTestMemPoolServingNode)} is disposed.", nameof(Global));
                }
            }
            catch (Exception ex)
            {
                Logger.LogWarning(ex, nameof(Global));
            }
        }
예제 #3
0
        public static async Task DisposeAsync()
        {
            await DisposeInWalletDependentServicesAsync();

            UpdateChecker?.Dispose();
            Logger.LogInfo($"{nameof(UpdateChecker)} is stopped.", nameof(Global));

            IndexDownloader?.Dispose();
            Logger.LogInfo($"{nameof(IndexDownloader)} is stopped.", nameof(Global));

            Directory.CreateDirectory(Path.GetDirectoryName(AddressManagerFilePath));
            AddressManager?.SavePeerFile(AddressManagerFilePath, Config.Network);
            Logger.LogInfo($"{nameof(AddressManager)} is saved to `{AddressManagerFilePath}`.", nameof(Global));

            Nodes?.Dispose();
            Logger.LogInfo($"{nameof(Nodes)} are disposed.", nameof(Global));

            if (RegTestMemPoolServingNode != null)
            {
                RegTestMemPoolServingNode.Disconnect();
                Logger.LogInfo($"{nameof(RegTestMemPoolServingNode)} is disposed.", nameof(Global));
            }
        }