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 'noPeers' event to torrents #775

Merged
merged 3 commits into from May 5, 2016
Merged
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

Prev

Update 'noPeers' to stop using deprecated 'torrent.swarm'

  • Loading branch information
Jonathan Harper
Jonathan Harper committed Apr 27, 2016
commit 97130eb7de2db1eac9f91482ca92b2da3b975eab
@@ -333,12 +333,12 @@ Torrent.prototype._onListening = function () {

function onTrackerAnnounce () {
self.emit('trackerAnnounce')
if (self.swarm.numPeers === 0) self.emit('noPeers', 'tracker')
if (self.numPeers === 0) self.emit('noPeers', 'tracker')
}

function onDHTAnnounce () {
self.emit('dhtAnnounce')
if (self.swarm.numPeers === 0) self.emit('noPeers', 'dht')
if (self.numPeers === 0) self.emit('noPeers', 'dht')
}

function onWarning (err) {
@@ -6,7 +6,7 @@ var test = require('tape')
var WebTorrent = require('../../')

test('Download using DHT (via .torrent file)', function (t) {
t.plan(9)
t.plan(10)

var dhtServer = new DHT({ bootstrap: false })

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