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

Improve tests; misc fixes #532

Merged
merged 9 commits into from Dec 18, 2015

don't add default trackers when { tracker: false }

When the user sets `{ tracker: false }` on the WebTorrent client, don’t
add trackers to the torrent by default.
  • Loading branch information
feross committed Dec 10, 2015
commit 4a759a59e2f127e0cded044dcd647084d1b8c26f
@@ -206,6 +206,7 @@ WebTorrent.prototype.seed = function (input, opts, onseed) {
// When seeding from filesystem, initialize store from that path (avoids a copy)
if (typeof input === 'string') opts.path = path.dirname(input)
if (!opts.createdBy) opts.createdBy = 'WebTorrent/' + VERSION_STR
if (!self.tracker) opts.announce = []

var streams
var torrent = self.add(undefined, opts, function (torrent) {
@@ -234,12 +234,12 @@ Torrent.prototype._processParsedTorrent = function (parsedTorrent) {
parsedTorrent.announce = parsedTorrent.announce.concat(this.announce)
}

if (global.WEBTORRENT_ANNOUNCE) {
if (this.client.tracker && global.WEBTORRENT_ANNOUNCE) {
// So `webtorrent-hybrid` can force specific trackers to be used
parsedTorrent.announce = parsedTorrent.announce.concat(global.WEBTORRENT_ANNOUNCE)
}

if (parsedTorrent.announce.length === 0) {
if (this.client.tracker && parsedTorrent.announce.length === 0) {
// When no trackers specified, use some reasonable defaults
parsedTorrent.announce = createTorrent.announceList.map(function (list) {
return list[0]
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.