diff options
-rw-r--r-- | lib/torrent.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/torrent.js b/lib/torrent.js index ef541ea..0254b87 100644 --- a/lib/torrent.js +++ b/lib/torrent.js @@ -300,6 +300,14 @@ class Torrent extends EventEmitter { }) } + if (this.info) { + // if full metadata was included in initial torrent id, use it immediately. Otherwise, + // wait for torrent-discovery to find peers and ut_metadata to get the metadata. + this._onMetadata(this) + } else if (this.xs) { + this._getMetadataFromServer() + } + // begin discovering peers via DHT and trackers this.discovery = new Discovery({ infoHash: this.infoHash, @@ -334,14 +342,6 @@ class Torrent extends EventEmitter { this.discovery.on('warning', (err) => { this.emit('warning', err) }) - - if (this.info) { - // if full metadata was included in initial torrent id, use it immediately. Otherwise, - // wait for torrent-discovery to find peers and ut_metadata to get the metadata. - this._onMetadata(this) - } else if (this.xs) { - this._getMetadataFromServer() - } } _getMetadataFromServer () { |