Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2016-07-28 23:56:46 +0300
committerFeross Aboukhadijeh <feross@feross.org>2016-07-28 23:56:46 +0300
commit1780fbb9b4c30715aa3d01a2b19e18b56b03dade (patch)
treeb05a14eded789675ebc34c30713b4df55586455d
parentff1af0091a79f9f0029758c5bdf768c7ae3b4c64 (diff)
Allow entire torrent deselect() to be called earlier
// Remove default selection (whole torrent) torrent.deselect(0, torrent.pieces.length - 1, false) Can now be called earlier, after 'metadata' instead of after 'ready' https://github.com/feross/webtorrent/issues/857#issuecomment-236022556
-rw-r--r--lib/torrent.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/torrent.js b/lib/torrent.js
index 5d2150b..f27296b 100644
--- a/lib/torrent.js
+++ b/lib/torrent.js
@@ -475,6 +475,11 @@ Torrent.prototype._onMetadata = function (metadata) {
self.addWebSeed(url)
})
+ // start off selecting the entire torrent with low priority
+ if (self.pieces.length !== 0) {
+ self.select(0, self.pieces.length - 1, false)
+ }
+
self._rarityMap = new RarityMap(self)
self.store = new ImmediateChunkStore(
@@ -610,11 +615,6 @@ Torrent.prototype._onStore = function () {
if (self.destroyed) return
self._debug('on store')
- // start off selecting the entire torrent with low priority
- if (self.pieces.length !== 0) {
- self.select(0, self.pieces.length - 1, false)
- }
-
self.ready = true
self.emit('ready')