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

Added pause/resume, refactored code, improved command line interface, etc #514

Closed
wants to merge 21 commits into from
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

got zuul tests to run

  • Loading branch information
whitef0x0 committed Dec 4, 2015
commit 74382ee42130cc4f1e47357aa54bd471c43124dc
@@ -1,5 +1,4 @@
node_modules
webtorrent.debug.js
coverage
content
examples/npm-debug.log
@@ -59,46 +59,42 @@ function Torrent (torrentId, opts) {

this.client = opts.client

self.parsedTorrent = null
this.parsedTorrent = null

self.announce = opts.announce
self.urlList = opts.urlList
this.announce = opts.announce
this.urlList = opts.urlList

this.path = opts.path
this._store = opts.store || FSChunkStore

self.shouldSeed = opts.shouldSeed || true
this.shouldSeed = opts.shouldSeed || true

self.strategy = opts.strategy || 'sequential'
this.strategy = opts.strategy || 'sequential'

this._rechokeNumSlots = (opts.uploads === false || opts.uploads === 0)
? 0
: (+opts.uploads || 10)
self._rechokeOptimisticWire = null
self._rechokeOptimisticTime = 0
self._rechokeIntervalId = null

self.ready = false
self.paused = false
self.resumed = false
self.destroyed = false
self.metadata = null
self.store = null
self.numBlockedPeers = 0
self.files = null
self.done = false

self._amInterested = false
self._selections = []
self._critical = []
this._rechokeOptimisticWire = null
this._rechokeOptimisticTime = 0
this._rechokeIntervalId = null

this.ready = false
this.destroyed = false
this.metadata = null
this.store = null
this.numBlockedPeers = 0
this.files = null
this.done = false

this._amInterested = false
this._selections = []
this._critical = []

// for cleanup
this._servers = []

if (torrentId) {
self.torrentId = torrentId
self._onTorrentId(torrentId)
}
if (torrentId) this._onTorrentId(torrentId)
}

// Time remaining (in milliseconds)
@@ -25,8 +25,8 @@
"dependencies": {
"addr-to-ip-port": "^1.0.1",
"bitfield": "^1.0.2",
"bittorrent-dht": "^4.0.4",
"bittorrent-swarm": "^5.0.0",
"bittorrent-dht": "^5.0.0",
"bittorrent-swarm": "^6.0.0",
"choices": "^0.1.3",
"chunk-store-stream": "^2.0.0",
"clivas": "^0.2.0",
@@ -117,10 +117,10 @@
"size": "npm run build && cat webtorrent.min.js | gzip | wc -c",
"test-local": "standard && node ./bin/test.js",
"coverage": "istanbul cover -- tape test/*.js && istanbul-coveralls",
"coverage-local": "istanbul cover -- tape test/*.js && http-server coverage/client/report-html/ -p 6000 && echo 'Istanbul coverage report available at 127.0.0.1:6000'",
"test": "standard && node ./bin/test.js && coverage",
"test-browser": "zuul -- test/basic.js",
"test-browser-local": "zuul --local -- test/basic.js",
"test-node": "tape test/*.js",
"test-append": "zuul --local -- test/browser/append-to.js"
"test-browser": "zuul -- test/browser/*.js",
"test-browser-local": "zuul --local 4000 -- test/browser/*.js",
"test-node": "tape test/*.js"
}
}
@@ -1,13 +1,12 @@
var path = require('path')
var fs = require('fs')
var extend = require('xtend')
var parseTorrent = require('parse-torrent')
var test = require('tape')
var WebTorrent = require('../')

var leaves = fs.readFileSync(path.resolve(__dirname, 'torrents', 'leaves.torrent'))
var leaves = fs.readFileSync(__dirname + '/torrents/leaves.torrent')
var leavesTorrent = parseTorrent(leaves)
var leavesBook = fs.readFileSync(path.resolve(__dirname, 'content', 'Leaves of Grass by Walt Whitman.epub'))
var leavesBook = fs.readFileSync(__dirname + 'content/Leaves of Grass by Walt Whitman.epub')

var leavesMagnetURI = 'magnet:?xt=urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36&dn=Leaves+of+Grass+by+Walt+Whitman.epub&tr=http%3A%2F%2Ftracker.bittorrent.am%2Fannounce&tr=http%3A%2F%2Ftracker.thepiratebay.org%2Fannounce&tr=udp%3A%2F%2Ffr33domtracker.h33t.com%3A3310%2Fannounce&tr=udp%3A%2F%2Ftracker.ccc.de%3A80&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80'

@@ -6,7 +6,7 @@ var AppendTo = require('../../lib/append-to')
var bigBuckFile = fs.readFileSync(__dirname + '/big-buck-bunny.mp4')

test('AppendTo should append and stream if file is video', function (t) {
t.plan(2)
t.plan(4)

//Start Seeding file
var client = new WebTorrent()
@@ -18,14 +18,14 @@ test('AppendTo should append and stream if file is video', function (t) {
console.log(file.name)
AppendTo(file, window.document.getElementsByTagName('body')[0], function (err, currElem) {
if(err) t.fail(err)

currElem.style.visibility = 'hidden'
console.log(currElem)

t.pass('appended video to html element')
t.equal(window.document.getElementsByName('video')[0], currElem)
t.equal(window.document.getElementsByName('video').length, 1)
t.equal(window.document.getElementsByTagName('video')[0], currElem)
t.equal(window.document.getElementsByTagName('video').length, 1)

t.equal(currElem.nodeName, "VIDEO")
t.equal(currElem.nodeName, 'VIDEO')
})
})
})

Large diffs are not rendered by default.

You are viewing a condensed version of this merge commit. You can view the full changes here.
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.