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

Remove _onStore() function

This function isn't useful anymore because store verification happens
after the 'ready' event.
  • Loading branch information
KayleePop committed Apr 11, 2018
commit 35aeb52801aa69ad4b69b6e7f5b459d94b01fda0
@@ -534,6 +534,8 @@ Torrent.prototype._onMetadata = function (metadata) {
self._onWireWithMetadata(wire)
})

self.emit('metadata')

self._debug('verifying existing torrent data')
if (self._fileModtimes && self._store === FSChunkStore) {
// don't verify if the files haven't been modified since we last checked
@@ -550,6 +552,9 @@ Torrent.prototype._onMetadata = function (metadata) {
for (var index = 0; index < self.pieces.length; index++) {
self._markInStore(index)
}
self._checkDone()

self.updateSelections()
} else {
self._verifyPieces()
}
@@ -558,8 +563,8 @@ Torrent.prototype._onMetadata = function (metadata) {
self._verifyPieces()
}

self.emit('metadata')
self._onStore()
self.ready = true
self.emit('ready')
}

/*
@@ -655,24 +660,6 @@ Torrent.prototype._markInStore = function (index) {
this.bitfield.set(index, true)
}

/**
* Called when the metadata, listening server, and underlying chunk store is initialized.
*/
Torrent.prototype._onStore = function () {
var self = this
if (self.destroyed) return
self._debug('on store')

self.ready = true
self.emit('ready')

// Files may start out done if the file was already in the store
self._checkDone()

// In case any selections were made before torrent was ready
self._updateSelections()
}

Torrent.prototype.destroy = function (cb) {
var self = this
self._destroy(null, cb)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.