Skip to content

Commit

Permalink
standard
Browse files Browse the repository at this point in the history
  • Loading branch information
feross committed Feb 18, 2018
1 parent b89afaa commit c29e02c
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 73 deletions.
6 changes: 3 additions & 3 deletions lib/torrent.js
Expand Up @@ -1472,9 +1472,9 @@ Torrent.prototype._request = function (wire, index, hotswap) {

var maxOutstandingRequests = isWebSeed
? Math.min(
getPiecePipelineLength(wire, PIPELINE_MAX_DURATION, self.pieceLength),
self.maxWebConns
)
getPiecePipelineLength(wire, PIPELINE_MAX_DURATION, self.pieceLength),
self.maxWebConns
)
: getBlockPipelineLength(wire, PIPELINE_MAX_DURATION)

if (numRequests >= maxOutstandingRequests) return false
Expand Down
140 changes: 70 additions & 70 deletions test/node/blocklist.js
Expand Up @@ -53,22 +53,22 @@ test('blocklist (array of IPs)', function (t) {
tracker: false,
blocklist: [ '1.2.3.4', '5.6.7.8' ]
})
.on('error', function (err) { t.fail(err) })
.on('warning', function (err) { t.fail(err) })
.on('ready', function () {
client.add(fixtures.leaves.parsedTorrent, function (torrent) {
assertBlocked(t, torrent, '1.2.3.4:1234')
assertBlocked(t, torrent, '1.2.3.4:6969')
assertBlocked(t, torrent, '5.6.7.8:1234')
assertBlocked(t, torrent, '5.6.7.8:6969')
assertReachable(t, torrent, '1.1.1.1:1234')
assertReachable(t, torrent, '1.1.1.1:6969')
.on('error', function (err) { t.fail(err) })
.on('warning', function (err) { t.fail(err) })
.on('ready', function () {
client.add(fixtures.leaves.parsedTorrent, function (torrent) {
assertBlocked(t, torrent, '1.2.3.4:1234')
assertBlocked(t, torrent, '1.2.3.4:6969')
assertBlocked(t, torrent, '5.6.7.8:1234')
assertBlocked(t, torrent, '5.6.7.8:6969')
assertReachable(t, torrent, '1.1.1.1:1234')
assertReachable(t, torrent, '1.1.1.1:6969')

client.destroy(function (err) {
t.error(err, 'client destroyed')
client.destroy(function (err) {
t.error(err, 'client destroyed')
})
})
})
})
})

// 48 asserts
Expand Down Expand Up @@ -120,16 +120,16 @@ test('blocklist (array of IP ranges)', function (t) {
{ start: '5.6.7.0', end: '5.6.7.255' }
]
})
.on('error', function (err) { t.fail(err) })
.on('warning', function (err) { t.fail(err) })
.on('ready', function () {
client.add(fixtures.leaves.parsedTorrent, function (torrent) {
assertList(t, torrent)
client.destroy(function (err) {
t.error(err, 'client destroyed')
.on('error', function (err) { t.fail(err) })
.on('warning', function (err) { t.fail(err) })
.on('ready', function () {
client.add(fixtures.leaves.parsedTorrent, function (torrent) {
assertList(t, torrent)
client.destroy(function (err) {
t.error(err, 'client destroyed')
})
})
})
})
})

test('blocklist (http url)', function (t) {
Expand All @@ -149,19 +149,19 @@ test('blocklist (http url)', function (t) {
tracker: false,
blocklist: url
})
.on('error', function (err) { t.fail(err) })
.on('warning', function (err) { t.fail(err) })
.on('ready', function () {
client.add(fixtures.leaves.parsedTorrent, function (torrent) {
assertList(t, torrent)
client.destroy(function (err) {
t.error(err, 'client destroyed')
})
server.close(function () {
t.pass('server closed')
.on('error', function (err) { t.fail(err) })
.on('warning', function (err) { t.fail(err) })
.on('ready', function () {
client.add(fixtures.leaves.parsedTorrent, function (torrent) {
assertList(t, torrent)
client.destroy(function (err) {
t.error(err, 'client destroyed')
})
server.close(function () {
t.pass('server closed')
})
})
})
})
})
})

Expand All @@ -185,19 +185,19 @@ test('blocklist (http url with gzip encoding)', function (t) {
tracker: false,
blocklist: url
})
.on('error', function (err) { t.fail(err) })
.on('warning', function (err) { t.fail(err) })
.on('ready', function () {
client.add(fixtures.leaves.parsedTorrent, function (torrent) {
assertList(t, torrent)
client.destroy(function (err) {
t.error(err, 'client destroyed')
})
server.close(function () {
t.pass('server closed')
.on('error', function (err) { t.fail(err) })
.on('warning', function (err) { t.fail(err) })
.on('ready', function () {
client.add(fixtures.leaves.parsedTorrent, function (torrent) {
assertList(t, torrent)
client.destroy(function (err) {
t.error(err, 'client destroyed')
})
server.close(function () {
t.pass('server closed')
})
})
})
})
})
})

Expand All @@ -221,19 +221,19 @@ test('blocklist (http url with deflate encoding)', function (t) {
tracker: false,
blocklist: url
})
.on('error', function (err) { t.fail(err) })
.on('warning', function (err) { t.fail(err) })
.on('ready', function () {
client.add(fixtures.leaves.parsedTorrent, function (torrent) {
assertList(t, torrent)
client.destroy(function (err) {
t.error(err, 'client destroyed')
})
server.close(function () {
t.pass('server closed')
.on('error', function (err) { t.fail(err) })
.on('warning', function (err) { t.fail(err) })
.on('ready', function () {
client.add(fixtures.leaves.parsedTorrent, function (torrent) {
assertList(t, torrent)
client.destroy(function (err) {
t.error(err, 'client destroyed')
})
server.close(function () {
t.pass('server closed')
})
})
})
})
})
})

Expand All @@ -244,16 +244,16 @@ test('blocklist (fs path)', function (t) {
tracker: false,
blocklist: fixtures.blocklist.path
})
.on('error', function (err) { t.fail(err) })
.on('warning', function (err) { t.fail(err) })
.on('ready', function () {
client.add(fixtures.leaves.parsedTorrent, function (torrent) {
assertList(t, torrent)
client.destroy(function (err) {
t.error(err, 'client destroyed')
.on('error', function (err) { t.fail(err) })
.on('warning', function (err) { t.fail(err) })
.on('ready', function () {
client.add(fixtures.leaves.parsedTorrent, function (torrent) {
assertList(t, torrent)
client.destroy(function (err) {
t.error(err, 'client destroyed')
})
})
})
})
})

test('blocklist (fs path with gzip)', function (t) {
Expand All @@ -263,14 +263,14 @@ test('blocklist (fs path with gzip)', function (t) {
tracker: false,
blocklist: fixtures.blocklist.gzipPath
})
.on('error', function (err) { t.fail(err) })
.on('warning', function (err) { t.fail(err) })
.on('ready', function () {
client.add(fixtures.leaves.parsedTorrent, function (torrent) {
assertList(t, torrent)
client.destroy(function (err) {
t.error(err, 'client destroyed')
.on('error', function (err) { t.fail(err) })
.on('warning', function (err) { t.fail(err) })
.on('ready', function () {
client.add(fixtures.leaves.parsedTorrent, function (torrent) {
assertList(t, torrent)
client.destroy(function (err) {
t.error(err, 'client destroyed')
})
})
})
})
})

0 comments on commit c29e02c

Please sign in to comment.