mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2024-12-13 19:06:27 +00:00
don't modify passed in torrent object
This commit is contained in:
parent
e5560d8f00
commit
153402ae85
11
client.js
11
client.js
@ -52,13 +52,16 @@ function Client (peerId, port, torrent, opts) {
|
||||
|
||||
debug('new client %s', self._infoHash.toString('hex'))
|
||||
|
||||
if (typeof torrent.announce === 'string') torrent.announce = [ torrent.announce ]
|
||||
if (torrent.announce == null) torrent.announce = []
|
||||
|
||||
var trackerOpts = { interval: self._intervalMs }
|
||||
var webrtcSupport = !!self._wrtc || typeof window !== 'undefined'
|
||||
|
||||
self._trackers = torrent.announce
|
||||
var announce = (typeof torrent.announce === 'string')
|
||||
? [ torrent.announce ]
|
||||
: torrent.announce == null
|
||||
? []
|
||||
: torrent.announce
|
||||
|
||||
self._trackers = announce
|
||||
.map(function (announceUrl) {
|
||||
var protocol = url.parse(announceUrl).protocol
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user