Comparing version 0.0.0 to 0.0.1-a
@@ -43,2 +43,3 @@ /*jshint node: true */ | ||
port: port, | ||
allowHalfOpen: true | ||
}, function() { | ||
@@ -45,0 +46,0 @@ resolve(new PeerConnection(socket)); |
@@ -51,5 +51,3 @@ /*jshint node: true */ | ||
this.begin = bytes.readInt32BE(9); | ||
this.length = bytes.readInt32BE(13); | ||
this.length = bytes.readInt32BE(13); | ||
} | ||
@@ -56,0 +54,0 @@ }; |
@@ -35,3 +35,3 @@ /*jshint node: true */ | ||
_reserved: { | ||
value: new Buffer([0,0,0,0,0,0,0]) | ||
value: new Buffer([0,0,0,0,0,0,0,0]) | ||
}, | ||
@@ -38,0 +38,0 @@ _infoHash: { |
@@ -116,3 +116,3 @@ /*jshint node: true */ | ||
PeerConnection.prototype.handshake = function(peerId) { | ||
PeerConnection.prototype.handshake = function(peerId, infoHash) { | ||
// create the message | ||
@@ -124,3 +124,6 @@ var msg = new Messages.Handshake(); | ||
msg.infoHash = infoHash; | ||
// send the message | ||
console.log(this._socket); | ||
this._socket.end(msg.toBuffer()); | ||
@@ -127,0 +130,0 @@ }; |
{ | ||
"name": "peerface", | ||
"version": "0.0.0", | ||
"version": "0.0.1a", | ||
"description": "bittorrent peer communication library", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -16,5 +16,7 @@ /*jshint node: true */ | ||
peerId = crypto.randomBytes(10).toString('hex'); | ||
var pstrlen = new Buffer(1); | ||
pstrlen.writeUInt8(19,0); | ||
var bytes = Buffer.concat([ | ||
// pstrlen | ||
new Buffer([19]), | ||
pstrlen, | ||
// pstr | ||
@@ -30,2 +32,3 @@ new Buffer('BitTorrent protocol'), | ||
console.log(new Buffer(peerId).length, bytes.length, 19+49); | ||
var msg = new lib.Messages.Handshake(bytes); | ||
@@ -37,3 +40,3 @@ | ||
t.equal(msg.peerId, peerId, "peer_ids should match"); | ||
t.deepEqual(msg.toBuffer(),bytes, "buffers should match"); | ||
t.end(); | ||
@@ -40,0 +43,0 @@ |
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
26011
926
2