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
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2015-08-22 18:58:08 +0300
committerFeross Aboukhadijeh <feross@feross.org>2015-08-22 18:58:08 +0300
commit07948311409a908605e8bb002edaafdbcccfb07d (patch)
tree27fc493542bf82b50168a1add45f3a668a1555e4 /lib/file.js
parent10ecb08b68aa3d18c34615464248dbaf5a7dccd0 (diff)
file: emit 'done' on zero-length file
Diffstat (limited to 'lib/file.js')
-rw-r--r--lib/file.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/file.js b/lib/file.js
index 4a0802d..44e8c6b 100644
--- a/lib/file.js
+++ b/lib/file.js
@@ -24,13 +24,18 @@ function File (torrent, file) {
this.length = file.length
this.offset = file.offset
- this.done = (this.length === 0)
+ this.done = false
var start = file.offset
var end = start + file.length - 1
this._startPiece = start / this._torrent.pieceLength | 0
this._endPiece = end / this._torrent.pieceLength | 0
+
+ if (this.length === 0) {
+ this.done = true
+ this.emit('done')
+ }
}
/**