From 2d3305139ebaf24d1fd5232a2c95553e80652417 Mon Sep 17 00:00:00 2001 From: Jaime Pillora Date: Thu, 14 Jan 2016 19:51:49 +1100 Subject: [PATCH] only update download rate when its positive --- engine/torrent.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engine/torrent.go b/engine/torrent.go index 92e33ea84..0591b9857 100644 --- a/engine/torrent.go +++ b/engine/torrent.go @@ -80,7 +80,10 @@ func (torrent *Torrent) Update(t torrent.Torrent) { if !torrent.updatedAt.IsZero() { dt := float32(now.Sub(torrent.updatedAt)) db := float32(bytes - torrent.Downloaded) - torrent.DownloadRate = db * (float32(time.Second) / dt) + rate := db * (float32(time.Second) / dt) + if rate >= 0 { + torrent.DownloadRate = rate + } } torrent.Downloaded = bytes torrent.updatedAt = now