From 16e44457fa5a5d8c84e80cbac9a5cbbb59f43c8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Rodr=C3=ADguez=20B?= Date: Wed, 2 Dec 2015 15:47:35 -0500 Subject: [PATCH] timeRemaining should be 0 once done (Fix #503) timeRemaining property should be 0 once a torrent has been downloaded (or is being seeded) --- lib/torrent.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/torrent.js b/lib/torrent.js index 6b58f776..64d38ffe 100644 --- a/lib/torrent.js +++ b/lib/torrent.js @@ -94,6 +94,7 @@ function Torrent (torrentId, opts) { // Time remaining (in milliseconds) Object.defineProperty(Torrent.prototype, 'timeRemaining', { get: function () { + if (this.done) return 0 if (this.swarm.downloadSpeed() === 0) return Infinity else return ((this.length - this.downloaded) / this.swarm.downloadSpeed()) * 1000 }