コード例 #1
0
 public NetworkRequiredConnection(ILogger <NetworkRequiredConnection> logger,
                                  IEventBus eventBus,
                                  IOptions <LightningNodeSettings> options,
                                  IConnectivityPeerStats serverPeerStats,
                                  IForgeClientConnectivity forgeConnectivity,
                                  IPeriodicWork connectionLoop) : base(logger, eventBus, serverPeerStats, forgeConnectivity, connectionLoop)
 {
     _settings = options.Value !;
 }
コード例 #2
0
        public RequiredConnection(ILogger <RequiredConnection> logger,
                                  IEventBus eventBus,
                                  IOptions <ForgeConnectivitySettings> options,
                                  IConnectivityPeerStats serverPeerStats,
                                  IForgeClientConnectivity forgeConnectivity,
                                  IPeriodicWork connectionLoop) : base(logger, eventBus, serverPeerStats, forgeConnectivity, connectionLoop)
        {
            _settings = options.Value !;

            connectionsToAttempt.AddRange(
                from connection in _settings.Connections
                select new OutgoingConnectionEndPoint(connection.GetIPEndPoint())
                );
        }
コード例 #3
0
        public ConnectorBase(ILogger logger,
                             IEventBus eventBus,
                             IConnectivityPeerStats serverPeerStats,
                             IForgeClientConnectivity forgeConnectivity,
                             IPeriodicWork connectionLoop)
        {
            this.logger            = logger;
            this.eventBus          = eventBus;
            peerStats              = serverPeerStats;
            this.forgeConnectivity = forgeConnectivity;
            this.connectionLoop    = connectionLoop;

            DefaultDelayBetweenAttempts = TimeSpan.FromSeconds(15);

            this.connectionLoop.Configure(stopOnException: true, exceptionHandler: this);
        }
コード例 #4
0
        public ExampleRequiredConnection(ILogger <ExampleRequiredConnection> logger,
                                         IEventBus eventBus,
                                         IOptions <ExampleSettings> options,
                                         IConnectivityPeerStats serverPeerStats,
                                         IForgeClientConnectivity forgeConnectivity,
                                         IPeriodicWork connectionLoop) : base(logger, eventBus, serverPeerStats, forgeConnectivity, connectionLoop)
        {
            _settings = options.Value !;

            foreach (ExampleClientPeerBinding peerBinding in _settings.Connections)
            {
                if (!peerBinding.TryGetExampleEndPoint(out ExampleEndPoint? endPoint))
                {
                    logger.LogWarning("Required connection skipped because of wrong format, check settings file. {Endpoint}", peerBinding.EndPoint);
                    continue;
                }

                var remoteEndPoint = new OutgoingConnectionEndPoint(endPoint);
                remoteEndPoint.Items[nameof(endPoint.MyExtraInformation)] = endPoint.MyExtraInformation;
                _connectionsToAttempt.Add(remoteEndPoint);
            }
        }