small cleanup

This commit is contained in:
Feross Aboukhadijeh 2015-07-04 17:10:41 -07:00
parent 3abb687b89
commit 37f95b4b54
2 changed files with 7 additions and 5 deletions

View File

@ -35,7 +35,7 @@ function parseUdpRequest (msg, rinfo) {
? ipLib.toString(ip)
: rinfo.address
params.key = msg.readUInt32BE(88) // TODO: what is this for?
params.key = msg.readUInt32BE(88) // Optional: unique random key from client
// never send more than MAX_ANNOUNCE_PEERS or else the UDP packet will get bigger than
// 512 bytes which is not safe

View File

@ -49,11 +49,13 @@ function serverTest (t, serverType, serverFamily) {
t.equal(data.complete, 0)
t.equal(data.incomplete, 1)
var swarm = server.getSwarm(infoHash)
t.equal(Object.keys(server.torrents).length, 1)
t.equal(server.getSwarm(infoHash).complete, 0)
t.equal(server.getSwarm(infoHash).incomplete, 1)
t.equal(Object.keys(server.getSwarm(infoHash).peers).length, 1)
t.deepEqual(server.getSwarm(infoHash).peers[clientAddr + ':6881'], {
t.equal(swarm.complete, 0)
t.equal(swarm.incomplete, 1)
t.equal(Object.keys(swarm.peers).length, 1)
t.deepEqual(swarm.peers[clientAddr + ':6881'], {
ip: clientIp,
port: 6881,
peerId: peerId.toString('hex'),