mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-25 15:01:34 +00:00
fix: avoid deleting nodes from peerBook
This commit is contained in:
@ -38,8 +38,8 @@ class Node extends EventEmitter {
|
|||||||
// If muxer exists, we can use Identify
|
// If muxer exists, we can use Identify
|
||||||
this.swarm.connection.reuse()
|
this.swarm.connection.reuse()
|
||||||
|
|
||||||
// Received incommind dial and muxer upgrade happened, reuse this
|
// Received incommind dial and muxer upgrade happened,
|
||||||
// muxed connection
|
// reuse this muxed connection
|
||||||
this.swarm.on('peer-mux-established', (peerInfo) => {
|
this.swarm.on('peer-mux-established', (peerInfo) => {
|
||||||
this.emit('peer:connect', peerInfo)
|
this.emit('peer:connect', peerInfo)
|
||||||
this.peerBook.put(peerInfo)
|
this.peerBook.put(peerInfo)
|
||||||
@ -47,7 +47,6 @@ class Node extends EventEmitter {
|
|||||||
|
|
||||||
this.swarm.on('peer-mux-closed', (peerInfo) => {
|
this.swarm.on('peer-mux-closed', (peerInfo) => {
|
||||||
this.emit('peer:disconnect', peerInfo)
|
this.emit('peer:disconnect', peerInfo)
|
||||||
this.peerBook.removeByB58String(peerInfo.id.toB58String())
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user