コード例 #1
0
ファイル: TorrentManager.cs プロジェクト: mattbab/OctoTorrent
        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);
        }
コード例 #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);
            });
        }
コード例 #3
0
ファイル: ClientEngine.cs プロジェクト: mrscylla/octotorrent
        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;
                                                               });
        }