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

Test excessive Memory Usage #1211

Closed
wants to merge 5 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

I think piece length is broken for web browsers

  • Loading branch information
disarticulate committed Oct 25, 2017
commit 9083d2aa00cd3dfba631596a168d8a4bbdf7cc6f
@@ -1,5 +1,5 @@
/* global FileList */

'use strict'
module.exports = WebTorrent

var Buffer = require('safe-buffer').Buffer
@@ -0,0 +1 @@
module.exports.EventEmitter = require('events').EventEmitter
@@ -1,7 +1,7 @@
module.exports = File

var eos = require('end-of-stream')
var EventEmitter = require('events').EventEmitter
var EventEmitter = require('./events').EventEmitter
var FileStream = require('./file-stream')
var inherits = require('inherits')
var path = require('path')
@@ -8,6 +8,8 @@ function RarityMap (torrent) {
var self = this

self._torrent = torrent
window.test = {}
window.test.torrent = torrent
self._numPieces = torrent.pieces.length
self._pieces = []

@@ -74,6 +76,7 @@ RarityMap.prototype.destroy = function () {
self._onWire = null
self._onWireHave = null
self._onWireBitfield = null
console.warn(self)
}

RarityMap.prototype._initWire = function (wire) {
@@ -7,7 +7,8 @@ var BitField = require('bitfield')
var ChunkStoreWriteStream = require('chunk-store-stream/write')
var debug = require('debug')('webtorrent:torrent')
var Discovery = require('torrent-discovery')
var EventEmitter = require('events').EventEmitter
console.warn('hello events')
var EventEmitter = require('./events').EventEmitter
var extend = require('xtend')
var extendMutable = require('xtend/mutable')
var fs = require('fs')
@@ -62,6 +63,7 @@ try {
}

inherits(Torrent, EventEmitter)
console.warn(Torrent)

function Torrent (torrentId, client, opts) {
EventEmitter.call(this)
@@ -258,7 +260,6 @@ Torrent.prototype._onParsedTorrent = function (parsedTorrent) {
self._rechoke()
}, RECHOKE_INTERVAL)
if (self._rechokeIntervalId.unref) self._rechokeIntervalId.unref()

// Private 'infoHash' event allows client.add to check for duplicate torrents and
// destroy them before the normal 'infoHash' event is emitted. Prevents user
// applications from needing to deal with duplicate 'infoHash' events.
@@ -121,6 +121,7 @@
"test-browser-headless": "zuul --electron -- test/*.js test/browser/*.js",
"test-browser-local": "zuul --local --open -- test/*.js test/browser/*.js",
"test-node": "tape test/*.js test/node/*.js",
"update-authors": "./bin/update-authors.sh"
"update-authors": "./bin/update-authors.sh",
"test:large": "zuul --local --open -- test/browser/large-file.js"
}
}
@@ -1,5 +1,4 @@
// var Buffer = require('safe-buffer').Buffer
var Buffer = require('buffer').Buffer
var Buffer = require('safe-buffer').Buffer
var test = require('tape')
var WebTorrent = require('../../')
var fs = require('fs')
@@ -17,18 +16,25 @@ var img3 = Buffer.from(data3, 'base64')
img3.name = 'img3.png'

test('seed Multiple Torrents', function (t) {
t.plan(3)
t.plan(4)
var client = new WebTorrent({ dht: false, tracker: false })

client.seed(img, function (torrent) {
var opts = {
announceList: [[]],
pieceLength: 1000000
}
client.seed(img, opts, function (torrent) {
t.equal(torrent.infoHash,'fe83c6629dc58cc08b7809256000ad068a167b95')
console.warn(torrent)
})

client.seed(img2, function (torrent) {
client.seed(img2, opts, function (torrent) {
t.equal(torrent.infoHash, 'fd5c8c050571e1f8c369541ed5560f7696931e3f')
console.warn(torrent)
})
client.seed(img3, function (torrent) {
client.seed(img3, opts, function (torrent) {
t.equal(torrent.infoHash,'c36facf1ca9d3071a81bc8f85f77d3fa3b684048')
t.equal(torrent, window.test.torrent)
console.warn(torrent)
})

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