Skip to content

Commit

Permalink
fix: always emit when a connection is made
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobheun committed May 28, 2020
1 parent 52a615f commit 72f37ac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/connection-manager/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@ class ConnectionManager extends EventEmitter {
const peerIdStr = peerId.toB58String()
const storedConn = this.connections.get(peerIdStr)

this.emit('peer:connect', connection)
if (storedConn) {
storedConn.push(connection)
} else {
this.connections.set(peerIdStr, [connection])
this.emit('peer:connect', connection)
}

this._libp2p.peerStore.keyBook.set(peerId, peerId.pubKey)
Expand Down

0 comments on commit 72f37ac

Please sign in to comment.