Example #1
0
 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);
 }
Example #2
0
        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;
            }
        }
Example #3
0
 public ScoreMirrorSelector(IHostChecker hostChecker, IReadOnlyCollection <Uri> hostPool)
     : this(DefaultScoreLimit, hostChecker, hostPool)
 {
 }
Example #4
0
 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) {}