public ScoreMirrorSelector(int scoreLimit, IHostChecker hostChecker, IReadOnlyCollection <Uri> hostPool) { ThrowWhenHostPoolIsNullOrEmpty(hostPool); _scoreLimit = scoreLimit; _hostScores = hostChecker.SortAndValidateHosts(hostPool).ToDictionary(x => x, x => new HostState()); _scoreMonitor = new TimerWithElapsedCancellationOnExceptionOnly(1 * 1000, IncreaseScoresWhenNeeded); }
public HostPicker(IEnumerable <Uri> hosts, MultiThreadingSettings multiThreadingSettings, Func <ExportLifetimeContext <IHostChecker> > hostChecker) { if (hosts == null) { throw new ArgumentNullException(nameof(hosts)); } ZsyncIncompatHosts = new List <Uri>(); MultiThreadingSettings = multiThreadingSettings; _hostChecker = hostChecker().Value; foreach (var host in hosts) { HostStates[host] = 0; } }
public ScoreMirrorSelector(IHostChecker hostChecker, IReadOnlyCollection <Uri> hostPool) : this(DefaultScoreLimit, hostChecker, hostPool) { }
public ScoreMirrorSelector(int scoreLimit, IHostChecker hostChecker, params Uri[] hostPool) : this(scoreLimit, hostChecker, (IReadOnlyCollection <Uri>)hostPool) { }
public ScoreMirrorSelector(IHostChecker hostChecker, IReadOnlyCollection<Uri> hostPool) : this(DefaultScoreLimit, hostChecker, hostPool) {}
public ScoreMirrorSelector(int scoreLimit, IHostChecker hostChecker, IReadOnlyCollection<Uri> hostPool) { ThrowWhenHostPoolIsNullOrEmpty(hostPool); _scoreLimit = scoreLimit; _hostScores = hostChecker.SortAndValidateHosts(hostPool).ToDictionary(x => x, x => new HostState()); _scoreMonitor = new TimerWithElapsedCancellationOnExceptionOnly(1*1000, IncreaseScoresWhenNeeded); }
public ScoreMirrorSelector(int scoreLimit, IHostChecker hostChecker, params Uri[] hostPool) : this(scoreLimit, hostChecker, (IReadOnlyCollection<Uri>) hostPool) {}