Exemplo n.º 1
0
        void CreateRateLimiters()
        {
            RateLimiter downloader = new RateLimiter();

            _downloadLimiter = new RateLimiterGroup();
            _downloadLimiter.Add(new PauseLimiter(this));
            _downloadLimiter.Add(downloader);

            RateLimiter uploader = new RateLimiter();

            _uploadLimiter = new RateLimiterGroup();
            _uploadLimiter.Add(new PauseLimiter(this));
            _uploadLimiter.Add(uploader);
        }
Exemplo n.º 2
0
        private void CreateRateLimiters()
        {
            var downloader = new RateLimiter();

            downloadLimiter = new RateLimiterGroup();
            downloadLimiter.Add(new DiskWriterLimiter(DiskManager));
            downloadLimiter.Add(downloader);

            var uploader = new RateLimiter();

            uploadLimiter = new RateLimiterGroup();
            downloadLimiter.Add(new DiskWriterLimiter(DiskManager));
            uploadLimiter.Add(uploader);

            MainLoop.QueueTimeout(TimeSpan.FromSeconds(1), () =>
            {
                downloader.UpdateChunks(
                    Settings.GlobalMaxDownloadSpeed,
                    TotalDownloadSpeed);
                uploader.UpdateChunks(Settings.GlobalMaxUploadSpeed,
                                      TotalUploadSpeed);
                return(!disposed);
            });
        }
Exemplo n.º 3
0
        private void CreateRateLimiters()
        {
            var downloader = new RateLimiter();
            downloadLimiter = new RateLimiterGroup();
            downloadLimiter.Add(new DiskWriterLimiter(DiskManager));
            downloadLimiter.Add(downloader);

            var uploader = new RateLimiter();
            uploadLimiter = new RateLimiterGroup();
            downloadLimiter.Add(new DiskWriterLimiter(DiskManager));
            uploadLimiter.Add(uploader);

            MainLoop.QueueTimeout(TimeSpan.FromSeconds(1), () =>
                                                               {
                                                                   downloader.UpdateChunks(
                                                                       Settings.GlobalMaxDownloadSpeed,
                                                                       TotalDownloadSpeed);
                                                                   uploader.UpdateChunks(Settings.GlobalMaxUploadSpeed,
                                                                                         TotalUploadSpeed);
                                                                   return !disposed;
                                                               });
        }