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

Option to disable BEP19 web seeds #911

Merged
merged 4 commits into from Sep 17, 2016
Merged

Option to disable BEP19 web seeds #911

merged 4 commits into from Sep 17, 2016

Conversation

@dcposch
Copy link
Contributor

dcposch commented Sep 15, 2016

  • For completeness. We have options to enable/disable WebRTC, the regular BitTorrent tracker client, and the DHT client. This lets us also enable/disable web seeds.
  • Useful for WebTorrent Desktop integration testing. See electron/electron#7212
Copy link
Member

DiegoRBaquero left a comment

LGTM. On another topic, should we add opts.maxWebConns to the client? It's in the torrent.

@dcposch dcposch force-pushed the web-seeds branch from db2ebe0 to dc108ed Sep 17, 2016
@dcposch dcposch merged commit dc108ed into master Sep 17, 2016
5 checks passed
5 checks passed
Node Security No known vulnerabilities found
Details
continuous-integration/appveyor/branch AppVeyor build succeeded
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@@ -1,7 +1,7 @@
{
"name": "webtorrent",
"description": "Streaming torrent client",
"version": "0.96.5",
"version": "0.97.0",

This comment has been minimized.

Copy link
@feross

feross Sep 17, 2016

Member

In the future, please don't change the package.json version in a PR. That's best done at release time with the npm version command (i.e. npm version patch, npm version minor, npm version major).

This comment has been minimized.

Copy link
@feross

feross Sep 17, 2016

Member

If you're curious about the exact commands I use to do a release, they are here: https://github.com/feross/prezto/blob/master/runcoms/zshrc#L31-L33

This comment has been minimized.

Copy link
@feross

feross Sep 17, 2016

Member

Sorry -- I see now that you did make a separate commit for the version bump. Still, it's not good to encourage this in PRs. When random people send you a PR and increment the version, it makes it harder to merge that PR.

This comment has been minimized.

Copy link
@dcposch

dcposch Sep 18, 2016

Author Contributor

I did use npm version minor

I bumped the version because I need it for the desktop app: webtorrent/webtorrent-desktop#913

## v0.97.0 - 2016-09-17

- Option to disable web seeds (BEP19)

## v0.95.2 - 2016-06-22

This comment has been minimized.

Copy link
@feross

feross Sep 17, 2016

Member

Looks like v0.96.0 is missing. I'll add it.

This comment has been minimized.

Copy link
@feross

feross Sep 17, 2016

Member

PR sent: #915

This comment has been minimized.

Copy link
@dcposch

dcposch Sep 18, 2016

Author Contributor

Left comments re some typos but otherwise looks good

tracker: Boolean|Object // Enable trackers (default=true), or options object for Tracker
tracker: Boolean|Object, // Enable trackers (default=true), or options object for Tracker
dht: Boolean|Object, // Enable DHT (default=true), or options object for DHT
webSeeds: Boolean // Enable BEP19 web seeds (default=true)

This comment has been minimized.

Copy link
@feross

feross Sep 17, 2016

Member

This would have been better as singular, webSeed IMO since we didn't name the other option trackers. No worries, I'll change it along with the other breaking API changes in v1.0.

This comment has been minimized.

Copy link
@dcposch

dcposch Sep 18, 2016

Author Contributor

I wanted to match webConns. The other options, tracker and dht, both take an object, this one just takes true or false.

I think it's fine but have no strong opinion, if you want to change it in 1.0 that's cool too

test('Download using webseed (via .torrent file)', function (t) {
t.plan(6)
t.timeoutAfter(WEB_SEED_TIMEOUT_MS)

This comment has been minimized.

Copy link
@feross

feross Sep 17, 2016

Member

Won't this just add flakiness to the test suite? We don't do this in any of the other tests. What if it takes 600ms to complete on Travis CI servers?

This comment has been minimized.

Copy link
@dcposch

dcposch Sep 18, 2016

Author Contributor

It completes very fast (~10ms) on my Macbook.

I added the timeout to match the timeout below. How do you verify that webSeeds: false is working? I thought: make sure that the webSeed download always completes in under X time, then set webSeeds: false and wait that same amount of time and verify there are no requests

client.add(parsedTorrent, {store: MemoryChunkStore})

// The test above ensures that we can download the whole torrent over webseeds within a
// short time. Here, we wait the same amount of time and make sure no HTTP requests happen.

This comment has been minimized.

Copy link
@feross

feross Sep 17, 2016

Member

I'm not sure what this comment means. Since the webSeeds option was set to false, no download progress will be made, right? This will just timeout after 500ms and move on to the cleanup code below.

That's fine, I think waiting 500ms is a reasonable way to ensure that no http requests get sent to the server, but the comment should be changed to be clearer.

This comment has been minimized.

Copy link
@feross

feross Sep 17, 2016

Member

Also, another test we can add here is:

var torrent = client.add(parsedTorrent, {store: MemoryChunkStore})

torrent.on('ready', function () {
  t.equal(torrent.urlList.length, 0) // ensure no web seeds were added
})

This comment has been minimized.

Copy link
@dcposch

dcposch Sep 18, 2016

Author Contributor

"The test above" refers to the test that has webSeeds enabled. There are two tests in the file, the first ensures that web seeds work, the second ensures that webSeeds: false works

This comment has been minimized.

Copy link
@dcposch

dcposch Sep 18, 2016

Author Contributor

I don't think that extra test works. It doesn't prevent urlList from being populated (just as setting tracker: false won't make the announce list empty, right?). It just means that none of those URLs will be contacted.

Copy link
Member

feross left a comment

Overall, looks great to me! Sorry for being so behind on reviews. I think it's great that you merged this, but please address the inline comments and send another PR to fix things up!

@feross feross deleted the web-seeds branch Sep 17, 2016
@lock

This comment has been minimized.

Copy link

lock bot commented May 4, 2018

This thread has been automatically locked because it has not had recent activity. To discuss futher, please open a new issue.

@lock lock bot locked as resolved and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.