Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add time remaining estimate and minor fixes #56

Merged
merged 10 commits into from May 18, 2014

added small optimization to FSStorage.readBlock to read blocks from i…

…n-memory buffer if possible
  • Loading branch information
transitive-bullshit committed May 16, 2014
commit d6d66ecccc175351a1a4af6aad3c3f8362f22173
@@ -88,6 +88,12 @@ FSStorage.prototype.readBlock = function (index, offset, length, cb) {
var piece = self.pieces[index]
if (!piece) return cb(new Error("invalid piece index " + index))

if (piece.verified && piece.buffer) {
// piece is verified and cached in memory, so read directly from its buffer
// instead of reading from the filesystem.
return piece.readBlock(offset, length, cb)
}

var rangeFrom = offset
var rangeTo = rangeFrom + length

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.