Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDiego Rodríguez B <DiegoRBaquero@users.noreply.github.com>2015-12-02 23:47:35 +0300
committerDiego Rodríguez B <DiegoRBaquero@users.noreply.github.com>2015-12-02 23:47:35 +0300
commit16e44457fa5a5d8c84e80cbac9a5cbbb59f43c8f (patch)
tree245e5fccb3746090a417cbe52c2d582981cfb9a9 /lib
parentcfca533063b6ffcf6fd231949762314c8bd73d5e (diff)
timeRemaining should be 0 once done (Fix #503)
timeRemaining property should be 0 once a torrent has been downloaded (or is being seeded)
Diffstat (limited to 'lib')
-rw-r--r--lib/torrent.js1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/torrent.js b/lib/torrent.js
index 6b58f77..64d38ff 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
}