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

Commit

Permalink
fix(swarm): move isConnected filter from addrs to peers (#901)
Browse files Browse the repository at this point in the history
  • Loading branch information
kumavis authored and daviddias committed Jul 7, 2017
1 parent 8b0f996 commit e2f371b
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/core/components/swarm.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,14 @@ module.exports = function swarm (self) {
// TODO: return latency and streams when verbose is set
// we currently don't have this information

const peers = self._peerInfoBook.getAll()
const keys = Object.keys(peers)

const peerList = flatMap(keys, (id) => {
const peer = peers[id]
const peers = values(self._peerInfoBook.getAll())
.filter((peer) => peer.isConnected())

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

if (verbose) {
Expand All @@ -53,7 +51,6 @@ module.exports = function swarm (self) {
}

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

callback(null, peers)
}),
Expand Down

0 comments on commit e2f371b

Please sign in to comment.