diff --git a/lib/parse_udp.js b/lib/parse_udp.js index 1a28160..d46ca4e 100644 --- a/lib/parse_udp.js +++ b/lib/parse_udp.js @@ -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 diff --git a/test/server.js b/test/server.js index c68048c..ef1253e 100644 --- a/test/server.js +++ b/test/server.js @@ -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'),