Skip to content

Commit

Permalink
update the state
Browse files Browse the repository at this point in the history
  • Loading branch information
weboko committed Feb 27, 2025
1 parent 05c6ff2 commit fd2bc63
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/sdk/src/waku/waku.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export class WakuNode implements IWaku {

// needed to create a lock for async operations
private _nodeStateLock = false;
private _nodeStarted = false;

private readonly peerManager: PeerManager;

Expand Down Expand Up @@ -203,6 +204,7 @@ export class WakuNode implements IWaku {
this.lightPush?.start();

this._nodeStateLock = false;
this._nodeStarted = true;
}

public async stop(): Promise<void> {
Expand All @@ -217,6 +219,7 @@ export class WakuNode implements IWaku {
await this.libp2p.stop();

this._nodeStateLock = false;
this._nodeStarted = false;
}

public async getConnectedPeers(): Promise<Peer[]> {
Expand All @@ -231,7 +234,7 @@ export class WakuNode implements IWaku {
}

public isStarted(): boolean {
return this.libp2p.status === "started";
return this._nodeStarted && this.libp2p.status === "started";
}

public isConnected(): boolean {
Expand Down

0 comments on commit fd2bc63

Please sign in to comment.