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

Defer Store Verification #1350

Open
wants to merge 5 commits into
base: master
from
Open
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

Clarify debug and error messages regarding piece verification

Specify whether the verification was on a piece in the store, or on a piece from a wire.
  • Loading branch information
KayleePop committed Apr 11, 2018
commit 40a67a5ba9c65325e68b647e30654b8b776ca52e
@@ -630,7 +630,7 @@ Torrent.prototype._verify = function (index, cb) {
if (self.bitfield.get(index)) return cb(null)

if (hash === self._hashes[index]) {
self._debug('piece verified %s', index)
self._debug('piece from store verified %s', index)
self._markInStore(index)

self.wires.forEach(function (wire) {
@@ -645,7 +645,7 @@ Torrent.prototype._verify = function (index, cb) {

cb(null)
} else {
self._debug('piece invalid %s', index)
self._debug('piece from store invalid %s', index)
self._verified[index] = true
self._update()
cb(null)
@@ -1568,7 +1568,7 @@ Torrent.prototype._request = function (wire, index, hotswap) {

if (hash === self._hashes[index]) {
if (!self.pieces[index]) return
self._debug('piece verified %s', index)
self._debug('piece from wire verified %s', index)

self.pieces[index] = null
self._reservations[index] = null
@@ -1585,7 +1585,7 @@ Torrent.prototype._request = function (wire, index, hotswap) {
if (self._checkDone() && !self.destroyed) self.discovery.complete()
} else {
self.pieces[index] = new Piece(piece.length)
self.emit('warning', new Error('Piece ' + index + ' failed verification'))
self.emit('warning', new Error('Piece from wire ' + index + ' failed verification'))
}
onUpdateTick()
})
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.