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

add default webrtc trackers when there is webrtc support #673

Closed
Closed
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

Next

add default webrtc trackers when there is webrtc support and global.W…

…EBTORRENT_ANNOUNCE is not defined

fix #672
  • Loading branch information
rom1504 committed Mar 14, 2016
commit b923ae71a5d1977486e576b907f4f5d2847c1055
@@ -30,6 +30,8 @@ var Swarm = require('bittorrent-swarm')
var uniq = require('uniq')
var ut_metadata = require('ut_metadata')
var ut_pex = require('ut_pex') // browser exclude
var Peer = require('simple-peer')
var createTorrent = require('create-torrent')

var File = require('./file')
var RarityMap = require('./rarity-map')
@@ -50,6 +52,16 @@ var TMP = typeof pathExists.sync === 'function'
? path.join(pathExists.sync('/tmp') ? '/tmp' : os.tmpDir(), 'webtorrent')
: '/tmp/webtorrent'

if (Peer.WEBRTC_SUPPORT && !global.WEBTORRENT_ANNOUNCE) {
global.WEBTORRENT_ANNOUNCE = createTorrent.announceList
.map(function (arr) {
return arr[0]
})
.filter(function (url) {
return url.indexOf('wss://') === 0 || url.indexOf('ws://') === 0
})
}

inherits(Torrent, EventEmitter)

/**
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.