public UdpPeerDiscoveryListener(ILoggerFactory loggerFactory, CompatibilityChecker compatibilityChecker, IPeerRegistry registry, NetworkSettings settings, DiscoveryAnnounceMessage announce)
 {
     this.logger = (loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory))).CreateLogger <UdpPeerDiscoveryListener>();
     this.compatibilityChecker = compatibilityChecker ?? throw new ArgumentNullException(nameof(compatibilityChecker));
     this.registry             = registry ?? throw new ArgumentNullException(nameof(registry));
     this.settings             = settings ?? throw new ArgumentNullException(nameof(settings));
     this.announce             = announce ?? throw new ArgumentNullException(nameof(announce));
     this.announceBytes        = settings.MessageSerializer.Serialize(announce);
 }
Ejemplo n.º 2
0
 public WebFacade(AppInfo appInfo, PackageDownloadManager packageDownloadManager, PackageDataValidator validator, LocalPackageManager localPackageManager, IPeerRegistry peerRegistry, IPackageRegistry packageRegistry, InstanceHash instanceHash, LongRunningTasksManager tasks, PeersCluster peersCluster)
 {
     this.appInfo = appInfo ?? throw new ArgumentNullException(nameof(appInfo));
     this.packageDownloadManager = packageDownloadManager ?? throw new ArgumentNullException(nameof(packageDownloadManager));
     this.validator           = validator ?? throw new ArgumentNullException(nameof(validator));
     this.localPackageManager = localPackageManager ?? throw new ArgumentNullException(nameof(localPackageManager));
     this.peerRegistry        = peerRegistry ?? throw new ArgumentNullException(nameof(peerRegistry));
     this.packageRegistry     = packageRegistry ?? throw new ArgumentNullException(nameof(packageRegistry));
     this.instanceHash        = instanceHash ?? throw new ArgumentNullException(nameof(instanceHash));
     this.tasks        = tasks ?? throw new ArgumentNullException(nameof(tasks));
     this.peersCluster = peersCluster ?? throw new ArgumentNullException(nameof(peersCluster));
 }
Ejemplo n.º 3
0
 public PeersCluster(AppInfo appInfo, IPeerRegistry peerRegistry, HttpApiClient client, IPackageRegistry packageRegistry, PackageDownloadManager packageDownloadManager)
 {
     this.appInfo                = appInfo ?? throw new ArgumentNullException(nameof(appInfo));
     this.peerRegistry           = peerRegistry ?? throw new ArgumentNullException(nameof(peerRegistry));
     this.client                 = client ?? throw new ArgumentNullException(nameof(client));
     this.packageRegistry        = packageRegistry ?? throw new ArgumentNullException(nameof(packageRegistry));
     this.packageDownloadManager = packageDownloadManager ?? throw new ArgumentNullException(nameof(packageDownloadManager));
     statusUpdateTimer           = new Timer(StatusUpdateTimerCallback, null, TimeSpan.Zero, TimeSpan.Zero);
     uploadSlots                 = appInfo.NetworkSettings.MaximumUploadsSlots;
     logger = appInfo.LoggerFactory.CreateLogger <PeersCluster>();
     peerRegistry.PeersChanged += PeerRegistry_PeersChanged;
     packageRegistry.NewLocalPackageCreated      += PackageRegistry_NewLocalPackageCreated;
     packageRegistry.LocalPackageDeleted         += PackageRegistry_LocalPackageDeleted;
     packageDownloadManager.DownloadStatusChange += PackageDownloadManager_DownloadStatusChange;
 }
 public PackageDownloadManager(AppInfo appInfo, HttpApiClient client, IPackageRegistry packageRegistry, IPeerRegistry peerRegistry)
 {
     this.appInfo                           = appInfo ?? throw new ArgumentNullException(nameof(appInfo));
     logger                                 = appInfo.LoggerFactory.CreateLogger <PackageDownloadManager>();
     this.client                            = client ?? throw new ArgumentNullException(nameof(client));
     this.packageRegistry                   = packageRegistry ?? throw new ArgumentNullException(nameof(packageRegistry));
     this.peerRegistry                      = peerRegistry ?? throw new ArgumentNullException(nameof(peerRegistry));
     postPoneUpdateDownloadFile             = new Dictionary <Hash, PostponeTimer>();
     downloadSlots                          = new List <PackageDownloadSlot>(MaximumDownloadSlots);
     downloads                              = new List <LocalPackageInfo>();
     packageStatusUpdater                   = new PackageStatusUpdater(appInfo.LoggerFactory, appInfo.NetworkSettings, client);
     peerRegistry.PeersChanged             += packageStatusUpdater.UpdatePeers;
     packageStatusUpdater.NewDataAvailable += TryScheduleNextDownload;
     packageRegistry.LocalPackageDeleting  += PackageRegistry_LocalPackageDeleting;
 }
Ejemplo n.º 5
0
 public AppInstanceBootstrapper(
     PackageDownloadManager packageDownloadManager,
     UdpPeerDiscovery udpPeerDiscovery,
     IPeerRegistry peerRegistry,
     IPackageRegistry packageRegistry,
     LocalPackageManager localPackageManager,
     PeersCluster peersCluster
     )
 {
     PackageDownloadManager = packageDownloadManager ?? throw new ArgumentNullException(nameof(packageDownloadManager));
     UdpPeerDiscovery       = udpPeerDiscovery ?? throw new ArgumentNullException(nameof(udpPeerDiscovery));
     PeerRegistry           = peerRegistry ?? throw new ArgumentNullException(nameof(peerRegistry));
     PackageRegistry        = packageRegistry ?? throw new ArgumentNullException(nameof(packageRegistry));
     LocalPackageManager    = localPackageManager ?? throw new ArgumentNullException(nameof(localPackageManager));
     PeersCluster           = peersCluster ?? throw new ArgumentNullException(nameof(peersCluster));
 }
Ejemplo n.º 6
0
 public UdpPeerDiscovery(AppInfo app, IPeerRegistry peerRegistry)
 {
     this.app          = app ?? throw new ArgumentNullException(nameof(app));
     this.peerRegistry = peerRegistry ?? throw new ArgumentNullException(nameof(peerRegistry));
     logger            = app.LoggerFactory.CreateLogger <UdpPeerDiscovery>();
 }