Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bittorrent-protocol

Package Overview
Dependencies
Maintainers
1
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bittorrent-protocol - npm Package Compare versions

Comparing version 0.7.2 to 0.8.0

test/state-change-on-end.js

6

index.js

@@ -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

2

package.json
{
"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)
})
})
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc