fix: await peer discovery start in libp2p start (#600)

This commit is contained in:
Cayman 2020-04-06 05:32:12 -05:00 committed by GitHub
parent da83721d6d
commit bd7fd0f755
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -399,7 +399,7 @@ class Libp2p extends EventEmitter {
* Called when libp2p has started and before it returns
* @private
*/
_onDidStart () {
async _onDidStart () {
this._isStarted = true
this.connectionManager.start()
@ -410,7 +410,7 @@ class Libp2p extends EventEmitter {
})
// Peer discovery
this._setupPeerDiscovery()
await this._setupPeerDiscovery()
// Once we start, emit and dial any peers we may have already discovered
for (const peerInfo of this.peerStore.peers.values()) {