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

VerifyPieces: Removed Parallel execution to prevent excessive memory consumption... #447

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Prev

Adjustments to syntax according to failing tests

  • Loading branch information
ngjermundshaug committed Sep 28, 2015
commit 40ef87592ef88483561204020e1ecec27b7db0de
@@ -80,7 +80,7 @@ function Torrent (torrentId, opts) {
self.numBlockedPeers = 0
self.files = null
self.done = false
self.verifyingPieces = false;
self.verifyingPieces = false

self._amInterested = false
self._selections = []
@@ -358,9 +358,8 @@ Torrent.prototype._onMetadata = function (metadata) {

self._onWireWithMetadata(wire)
})


//verify pieces

// Verify pieces
var verifyPiece = function (index) {
self.store.get(index, function (err, buf) {
if (!err) {
@@ -372,23 +371,22 @@ Torrent.prototype._onMetadata = function (metadata) {
self._reservations[index] = null
self.bitfield.set(index, true)
} else {
debug('piece invalid %s', index)
debug('piece invalid %s', index)
}
})
}
//Verify next piece?
// Verify next piece?
if (index + 1 < self.pieces.length) {
setImmediate(function () { verifyPiece(index + 1) });
}
else {
self.verifyingPieces = false;
setImmediate(function () { verifyPiece(index + 1) })
} else {
self.verifyingPieces = false
debug('done verifying')
}
})
}
debug('verifying existing torrent data')
self.verifyingPieces = true;
verifyPiece(0);
self.verifyingPieces = true
verifyPiece(0)

self.emit('metadata')
self._onStore()
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.