mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-05-21 06:31:22 +00:00
chore: _isStarted is false when stop starts
This commit is contained in:
parent
da5785d18e
commit
4848313cb3
@ -247,6 +247,7 @@ class Libp2p extends EventEmitter {
|
||||
log('libp2p is stopping')
|
||||
|
||||
try {
|
||||
this._isStarted = false
|
||||
for (const service of this._discovery.values()) {
|
||||
service.removeListener('peer', this._onDiscoveryPeer)
|
||||
}
|
||||
@ -258,7 +259,6 @@ class Libp2p extends EventEmitter {
|
||||
await this.peerStore.stop()
|
||||
await this.connectionManager.stop()
|
||||
|
||||
ping.unmount(this)
|
||||
await Promise.all([
|
||||
this.pubsub && this.pubsub.stop(),
|
||||
this._dht && this._dht.stop(),
|
||||
@ -267,6 +267,8 @@ class Libp2p extends EventEmitter {
|
||||
|
||||
await this.transportManager.close()
|
||||
|
||||
ping.unmount(this)
|
||||
|
||||
this.dialer.destroy()
|
||||
} catch (err) {
|
||||
if (err) {
|
||||
@ -274,7 +276,6 @@ class Libp2p extends EventEmitter {
|
||||
this.emit('error', err)
|
||||
}
|
||||
}
|
||||
this._isStarted = false
|
||||
log('libp2p has stopped')
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user