diff --git a/doc/API.md b/doc/API.md index 50c0efca..80080704 100644 --- a/doc/API.md +++ b/doc/API.md @@ -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] diff --git a/src/connection-manager/index.js b/src/connection-manager/index.js index d6b50324..b6aad603 100644 --- a/src/connection-manager/index.js +++ b/src/connection-manager/index.js @@ -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)