Skip to content

Commit 09dd029

Browse files
authored
fix: set libp2p status to started before stopping (#2288)
In order to stop components that have been started during a failed startup, set the current status to started after catching the error - `this.stop` will immediately set it to `stopping`.
1 parent 5a9362e commit 09dd029

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

packages/libp2p/src/libp2p.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,8 @@ export class Libp2pNode<T extends ServiceMap = Record<string, unknown>> extends
215215
this.log('libp2p has started')
216216
} catch (err: any) {
217217
this.log.error('An error occurred starting libp2p', err)
218+
// set status to 'started' so this.stop() will stop any running components
219+
this.status = 'started'
218220
await this.stop()
219221
throw err
220222
}

0 commit comments

Comments
 (0)