File tree 1 file changed +4
-5
lines changed
1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -160,7 +160,6 @@ class Libp2p extends EventEmitter {
160
160
log ( 'libp2p is starting' )
161
161
try {
162
162
await this . _onStarting ( )
163
- this . _isStarted = true
164
163
await this . _onDidStart ( )
165
164
log ( 'libp2p has started' )
166
165
} catch ( err ) {
@@ -332,10 +331,10 @@ class Libp2p extends EventEmitter {
332
331
* @private
333
332
*/
334
333
_onDidStart ( ) {
334
+ this . _isStarted = true
335
+
335
336
// Peer discovery
336
- if ( this . _modules . peerDiscovery ) {
337
- this . _setupPeerDiscovery ( )
338
- }
337
+ this . _setupPeerDiscovery ( )
339
338
340
339
// Once we start, emit and dial any peers we may have already discovered
341
340
for ( const peerInfo of this . peerStore . peers . values ( ) ) {
@@ -395,7 +394,7 @@ class Libp2p extends EventEmitter {
395
394
* @returns {Promise<void> }
396
395
*/
397
396
_setupPeerDiscovery ( ) {
398
- for ( const DiscoveryService of this . _modules . peerDiscovery ) {
397
+ for ( const DiscoveryService of this . _modules . peerDiscovery || [ ] ) {
399
398
let config = {
400
399
enabled : true // on by default
401
400
}
You can’t perform that action at this time.
0 commit comments