Skip to content

Commit 810e89b

Browse files
committed
chore: address review
1 parent 5159242 commit 810e89b

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/index.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ class Libp2p extends EventEmitter {
160160
log('libp2p is starting')
161161
try {
162162
await this._onStarting()
163-
this._isStarted = true
164163
await this._onDidStart()
165164
log('libp2p has started')
166165
} catch (err) {
@@ -332,10 +331,10 @@ class Libp2p extends EventEmitter {
332331
* @private
333332
*/
334333
_onDidStart () {
334+
this._isStarted = true
335+
335336
// Peer discovery
336-
if (this._modules.peerDiscovery) {
337-
this._setupPeerDiscovery()
338-
}
337+
this._setupPeerDiscovery()
339338

340339
// Once we start, emit and dial any peers we may have already discovered
341340
for (const peerInfo of this.peerStore.peers.values()) {
@@ -395,7 +394,7 @@ class Libp2p extends EventEmitter {
395394
* @returns {Promise<void>}
396395
*/
397396
_setupPeerDiscovery () {
398-
for (const DiscoveryService of this._modules.peerDiscovery) {
397+
for (const DiscoveryService of this._modules.peerDiscovery || []) {
399398
let config = {
400399
enabled: true // on by default
401400
}

0 commit comments

Comments
 (0)