コード例 #1
0
        /// <summary>
        /// Adds the network connector.
        /// </summary>
        /// <param name="connector">The connector.</param>
        public void AddNetworkConnector(INetworkConnector connector)
        {
            connectors.Add(connector);

            if (networkSystemRun)
            {
                connector.Start();
            }
        }
コード例 #2
0
        /// <inheritdoc cref="IRegistryService.StartupAsync(CancellationToken)"/>
        public async Task StartupAsync(CancellationToken cancellationToken)
        {
            // Link cancellation tokens.
            CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromMinutes(5));

            using CancellationTokenSource cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, cancellationTokenSource.Token);
            await _networkConnector.ConnectAsync(cancellationToken);

            _networkConnector.Start();
        }