bittorrent-protocol
Advanced tools
Comparing version 0.7.2 to 0.8.0
@@ -88,2 +88,8 @@ module.exports = Wire | ||
Wire.prototype.end = function () { | ||
this._onUninterested() | ||
this._onChoke() | ||
stream.Duplex.prototype.end.apply(this, arguments) | ||
} | ||
// | ||
@@ -90,0 +96,0 @@ // OUTGOING MESSAGES |
{ | ||
"name": "bittorrent-protocol", | ||
"description": "Simple, robust, BitTorrent peer wire protocol implementation", | ||
"version": "0.7.2", | ||
"version": "0.8.0", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Feross Aboukhadijeh", |
@@ -7,3 +7,3 @@ var Protocol = require('../') | ||
var wire = Protocol() | ||
var wire = new Protocol() | ||
wire.pipe(wire) | ||
@@ -24,3 +24,3 @@ | ||
var wire = Protocol() | ||
var wire = new Protocol() | ||
wire.pipe(wire) | ||
@@ -41,3 +41,3 @@ | ||
var wire = Protocol() | ||
var wire = new Protocol() | ||
wire.pipe(wire) | ||
@@ -60,3 +60,3 @@ wire.handshake(new Buffer('01234567890123456789'), new Buffer('12345678901234567890')) | ||
var wire = Protocol() | ||
var wire = new Protocol() | ||
wire.pipe(wire) | ||
@@ -79,3 +79,3 @@ wire.handshake(new Buffer('01234567890123456789'), new Buffer('12345678901234567890')) | ||
var wire = Protocol() | ||
var wire = new Protocol() | ||
wire.pipe(wire) | ||
@@ -109,6 +109,6 @@ wire.handshake(new Buffer('01234567890123456789'), new Buffer('12345678901234567890')) | ||
test('Have', function (t) { | ||
test('No duplicate `have` events for same piece', function (t) { | ||
t.plan(6) | ||
var wire = Protocol() | ||
var wire = new Protocol() | ||
wire.pipe(wire) | ||
@@ -120,12 +120,16 @@ | ||
wire.on('have', function (index) { | ||
haveEvents++ | ||
haveEvents += 1 | ||
}) | ||
t.equal(haveEvents, 0) | ||
t.equal(!!wire.peerPieces[0], false) | ||
wire._onHave(0) | ||
t.equal(haveEvents, 1, 'emitted event for new piece') | ||
t.equal(!!wire.peerPieces[0], true) | ||
wire._onHave(0) | ||
t.equal(haveEvents, 1, 'not emitted event for preexisting piece') | ||
t.equal(!!wire.peerPieces[0], true) | ||
wire.have(0) | ||
setTimeout(function () { | ||
t.equal(haveEvents, 1, 'emitted event for new piece') | ||
t.equal(!!wire.peerPieces[0], true) | ||
wire.have(0) | ||
setTimeout(function () { | ||
t.equal(haveEvents, 1, 'not emitted event for preexisting piece') | ||
t.equal(!!wire.peerPieces[0], true) | ||
}) | ||
}) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27023
10
659