Skip to content

Commit e87b42b

Browse files
chore: apply suggestions from code review
Co-Authored-By: Jacob Heun <jacobheun@gmail.com>
1 parent a55a4dc commit e87b42b

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

doc/API.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1168,15 +1168,15 @@ unless they are performing a specific action. See [peer discovery and auto dial]
11681168

11691169
This event will be triggered anytime a new Connection is established to another peer.
11701170

1171-
`libp2p.on('peer:connect', (connection) => {})`
1171+
`libp2p.connectionManager.on('peer:connect', (connection) => {})`
11721172

11731173
- `connection`: instance of [`Connection`][connection]
11741174

11751175
#### An existing connection to a peer has been closed
11761176

11771177
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.
11781178

1179-
`libp2p.on('peer:disconnect', (connection) => {})`
1179+
`libp2p.connectionManager.on('peer:disconnect', (connection) => {})`
11801180

11811181
- `connection`: instance of [`Connection`][connection]
11821182

src/connection-manager/index.js

-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const retimer = require('retimer')
99
const { EventEmitter } = require('events')
1010

1111
const PeerId = require('peer-id')
12-
const { Connection } = require('libp2p-interfaces/src/connection')
1312

1413
const {
1514
ERR_INVALID_PARAMETERS
@@ -172,10 +171,6 @@ class ConnectionManager extends EventEmitter {
172171
* @param {Connection} connection
173172
*/
174173
onConnect (connection) {
175-
if (!Connection.isConnection(connection)) {
176-
throw errcode(new Error('conn must be an instance of interface-connection'), ERR_INVALID_PARAMETERS)
177-
}
178-
179174
const peerId = connection.remotePeer.toB58String()
180175
const storedConn = this.connections.get(peerId)
181176

0 commit comments

Comments
 (0)