perf: don't dynamically add new properties to peer objects

This commit is contained in:
Feross Aboukhadijeh 2015-02-02 15:20:15 -08:00
parent a65c733125
commit 6ac9ae6a6e
2 changed files with 4 additions and 2 deletions

View File

@ -42,7 +42,8 @@ Swarm.prototype._onAnnounce_started = function (params, peer) {
peer = this.peers[params.addr] = {
ip: params.ip,
port: params.port,
peerId: params.peer_id
peerId: params.peer_id,
complete: false
}
}

View File

@ -56,7 +56,8 @@ function serverTest (t, serverType, serverFamily) {
t.deepEqual(server.getSwarm(infoHash).peers[clientAddr + ':6881'], {
ip: clientIp,
port: 6881,
peerId: peerId.toString('hex')
peerId: peerId.toString('hex'),
complete: false
})
client.complete()