Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: waku_node.nim - simplify stop proc #2645

Merged
merged 1 commit into from
Apr 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 3 additions & 7 deletions waku/node/waku_node.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1217,13 +1217,6 @@ proc start*(node: WakuNode) {.async.} =
info "Node started successfully"

proc stop*(node: WakuNode) {.async.} =
if not node.wakuRelay.isNil():
await node.wakuRelay.stop()

if not node.wakuMetadata.isNil():
node.wakuMetadata.stop()

await node.switch.stop()
node.peerManager.stop()

if not node.wakuRlnRelay.isNil():
Expand All @@ -1235,6 +1228,9 @@ proc stop*(node: WakuNode) {.async.} =
if not node.wakuArchive.isNil():
await node.wakuArchive.stopWait()

## By stopping the switch we are stopping all the underlying mounted protocols
await node.switch.stop()

node.started = false

proc isReady*(node: WakuNode): Future[bool] {.async: (raises: [Exception]).} =
Expand Down