Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
Only show connected addrs for peers in swarm.peers
Browse files Browse the repository at this point in the history
  • Loading branch information
victorb committed Aug 26, 2017
1 parent a85cf70 commit 499a25c
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/core/components/swarm.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,19 @@ module.exports = function swarm (self) {
// we currently don't have this information

const peers = values(self._peerInfoBook.getAll())
.filter((peer) => peer.isConnected())

const peerList = flatMap(peers, (peer) => {
return peer.multiaddrs.toArray().map((addr) => {
.map((peer) => {
const connectedAddr = peer.isConnected()
const res = {
addr: addr,
peer: peer
addr: connectedAddr,
peer
}

if (verbose) {
res.latency = 'unknown'
}

return res
})
})

callback(null, peerList)
callback(null, peers)
}),

// all the addrs we know
Expand Down

0 comments on commit 499a25c

Please sign in to comment.