diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2015-08-22 18:58:08 +0300 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2015-08-22 18:58:08 +0300 |
commit | 07948311409a908605e8bb002edaafdbcccfb07d (patch) | |
tree | 27fc493542bf82b50168a1add45f3a668a1555e4 /lib/file.js | |
parent | 10ecb08b68aa3d18c34615464248dbaf5a7dccd0 (diff) |
file: emit 'done' on zero-length file
Diffstat (limited to 'lib/file.js')
-rw-r--r-- | lib/file.js | 7 |
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') + } } /** |