mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-04-25 10:32:14 +00:00
fix: always emit when a connection is made
This commit is contained in:
parent
52a615f922
commit
72f37acd4a
@ -175,11 +175,11 @@ class ConnectionManager extends EventEmitter {
|
|||||||
const peerIdStr = peerId.toB58String()
|
const peerIdStr = peerId.toB58String()
|
||||||
const storedConn = this.connections.get(peerIdStr)
|
const storedConn = this.connections.get(peerIdStr)
|
||||||
|
|
||||||
|
this.emit('peer:connect', connection)
|
||||||
if (storedConn) {
|
if (storedConn) {
|
||||||
storedConn.push(connection)
|
storedConn.push(connection)
|
||||||
} else {
|
} else {
|
||||||
this.connections.set(peerIdStr, [connection])
|
this.connections.set(peerIdStr, [connection])
|
||||||
this.emit('peer:connect', connection)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this._libp2p.peerStore.keyBook.set(peerId, peerId.pubKey)
|
this._libp2p.peerStore.keyBook.set(peerId, peerId.pubKey)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user