mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-04-25 10:32:14 +00:00
chore: apply suggestions from code review
Co-Authored-By: Jacob Heun <jacobheun@gmail.com>
This commit is contained in:
parent
fdf31c9bbb
commit
fb5252f398
@ -1168,7 +1168,7 @@ unless they are performing a specific action. See [peer discovery and auto dial]
|
||||
|
||||
This event will be triggered anytime a new Connection is established to another peer.
|
||||
|
||||
`libp2p.on('peer:connect', (connection) => {})`
|
||||
`libp2p.connectionManager.on('peer:connect', (connection) => {})`
|
||||
|
||||
- `connection`: instance of [`Connection`][connection]
|
||||
|
||||
@ -1176,7 +1176,7 @@ This event will be triggered anytime a new Connection is established to another
|
||||
|
||||
This event will be triggered anytime we are disconnected from another peer, regardless of the circumstances of that disconnection. If we happen to have multiple connections to a peer, this event will **only** be triggered when the last connection is closed.
|
||||
|
||||
`libp2p.on('peer:disconnect', (connection) => {})`
|
||||
`libp2p.connectionManager.on('peer:disconnect', (connection) => {})`
|
||||
|
||||
- `connection`: instance of [`Connection`][connection]
|
||||
|
||||
|
@ -9,7 +9,6 @@ const retimer = require('retimer')
|
||||
const { EventEmitter } = require('events')
|
||||
|
||||
const PeerId = require('peer-id')
|
||||
const { Connection } = require('libp2p-interfaces/src/connection')
|
||||
|
||||
const {
|
||||
ERR_INVALID_PARAMETERS
|
||||
@ -172,10 +171,6 @@ class ConnectionManager extends EventEmitter {
|
||||
* @param {Connection} connection
|
||||
*/
|
||||
onConnect (connection) {
|
||||
if (!Connection.isConnection(connection)) {
|
||||
throw errcode(new Error('conn must be an instance of interface-connection'), ERR_INVALID_PARAMETERS)
|
||||
}
|
||||
|
||||
const peerId = connection.remotePeer.toB58String()
|
||||
const storedConn = this.connections.get(peerId)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user