コード例 #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);
 }
コード例 #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;
            }
        }
コード例 #3
0
 public ScoreMirrorSelector(IHostChecker hostChecker, IReadOnlyCollection <Uri> hostPool)
     : this(DefaultScoreLimit, hostChecker, hostPool)
 {
 }
コード例 #4
0
 public ScoreMirrorSelector(int scoreLimit, IHostChecker hostChecker, params Uri[] hostPool)
     : this(scoreLimit, hostChecker, (IReadOnlyCollection <Uri>)hostPool)
 {
 }
コード例 #5
0
 public ScoreMirrorSelector(IHostChecker hostChecker, IReadOnlyCollection<Uri> hostPool)
     : this(DefaultScoreLimit, hostChecker, hostPool) {}
コード例 #6
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);
 }
コード例 #7
0
 public ScoreMirrorSelector(int scoreLimit, IHostChecker hostChecker, params Uri[] hostPool)
     : this(scoreLimit, hostChecker, (IReadOnlyCollection<Uri>) hostPool) {}