This repository was archived by the owner on Jun 26, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -55,20 +55,20 @@ class MulticodecTopology extends Topology {
55
55
56
56
/**
57
57
* Update topology.
58
- * @param {Array<{id: PeerId, multiaddrs: Array<Multiaddr>}> } peerDataIterable
58
+ * @param {Array<{id: PeerId, multiaddrs: Array<Multiaddr>, protocols: Array<string> }> } peerDataIterable
59
59
* @returns {void }
60
60
*/
61
61
_updatePeers ( peerDataIterable ) {
62
- for ( const peerData of peerDataIterable ) {
63
- if ( this . multicodecs . filter ( multicodec => peerData . protocols . includes ( multicodec ) ) . length ) {
62
+ for ( const { id , protocols } of peerDataIterable ) {
63
+ if ( this . multicodecs . filter ( multicodec => protocols . includes ( multicodec ) ) . length ) {
64
64
// Add the peer regardless of whether or not there is currently a connection
65
- this . peers . add ( peerData . id . toB58String ( ) )
65
+ this . peers . add ( id . toB58String ( ) )
66
66
// If there is a connection, call _onConnect
67
- const connection = this . _registrar . getConnection ( peerData . id )
68
- connection && this . _onConnect ( peerData . id , connection )
67
+ const connection = this . _registrar . getConnection ( id )
68
+ connection && this . _onConnect ( id , connection )
69
69
} else {
70
70
// Remove any peers we might be tracking that are no longer of value to us
71
- this . peers . delete ( peerData . id . toB58String ( ) )
71
+ this . peers . delete ( id . toB58String ( ) )
72
72
}
73
73
}
74
74
}
You can’t perform that action at this time.
0 commit comments