예제 #1
0
        private void OnStatsReport()
        {
            if (Mode == null) return;

            var downloaded = (long)Math.Min(Mode.BlockStrategist.Available * Global.Instance.BlockSize, Data.TotalLength);
            var totalPeers = Mode.Peers.Count;
            var chokedBy = Mode.Peers.Count(p => p.Value.AmChoked);

            var stats = new StatsEventArgs(downloaded, totalPeers, chokedBy, 0);
            EventHandler<StatsEventArgs> handler = ReportStats;
            if (handler != null) handler(this, stats);
        }
예제 #2
0
 private void torrent_ReportStatsChanged(object sender, StatsEventArgs e)
 {
     DownloadedBytes(e.BytesCompleted);
     chokedBy = e.ChokedBy;
     totalPeers = e.TotalPeers;
     queued = e.QueuedRequests;
 }