mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2025-02-22 13:19:04 +00:00
handle case where magnet uri has only one 'tr' param
This commit is contained in:
parent
6f565ed6fa
commit
2983811a71
4
index.js
4
index.js
@ -399,6 +399,10 @@ function Client (peerId, port, torrent, opts) {
|
||||
self._numWant = self._opts.numWant || 80
|
||||
self._intervalMs = self._opts.interval || (30 * 60 * 1000) // default: 30 minutes
|
||||
|
||||
if (typeof torrent.announce === 'string') {
|
||||
// magnet-uri returns a string if the magnet uri only contains one 'tr' parameter
|
||||
torrent.announce = [torrent.announce]
|
||||
}
|
||||
self._trackers = torrent.announce.map(function (announceUrl) {
|
||||
return new Tracker(self, announceUrl, self._opts)
|
||||
})
|
||||
|
@ -11,7 +11,7 @@ var port = 6881
|
||||
// remove all tracker servers except a single UDP one, for now
|
||||
parsedTorrent.announce = [ 'udp://tracker.publicbt.com:80/announce' ]
|
||||
|
||||
test('client.start()', function (t) {
|
||||
test('large torrent: client.start()', function (t) {
|
||||
t.plan(4)
|
||||
|
||||
var client = new Client(peerId, port, parsedTorrent)
|
||||
|
Loading…
Reference in New Issue
Block a user