Beispiel #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);
 }
Beispiel #2
0
 protected virtual void Dispose(bool b)
 {
     if (_timer != null)
     {
         _timer.Dispose();
         _timer = null;
     }
 }
 internal StatusProcessor(IAbsoluteFilePath dest, ITProgress status, long predictedSize)
 {
     _dest          = dest;
     _status        = status;
     _predictedSize = predictedSize;
     _startTime     = DateTime.UtcNow;
     _timer         = new TimerWithElapsedCancellationOnExceptionOnly(TimeSpan.FromMilliseconds(250),
                                                                      CalculateProgressAndSpeed);
 }