Skip to content

Commit fb97ec8

Browse files
committed
chore: async stop process
1 parent 09f2af4 commit fb97ec8

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

examples/pingpong.nim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,16 @@ proc main() {.async.} =
6969
await saro.start()
7070
await raya.start()
7171

72-
await sleepAsync(5.seconds)
72+
await sleepAsync(10.seconds)
7373

7474
# Perform OOB Introduction: Raya -> Saro
7575
let raya_bundle = raya.createIntroBundle()
7676
discard await saro.newPrivateConversation(raya_bundle)
7777

7878
await sleepAsync(20.seconds) # Run for some time
7979

80-
saro.stop()
81-
raya.stop()
80+
await saro.stop()
81+
await raya.stop()
8282

8383

8484
when isMainModule:

src/chat/client.nim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,8 @@ proc start*(client: Client) {.async.} =
291291

292292
notice "Client start complete", client = client.getId()
293293

294-
proc stop*(client: Client) =
294+
proc stop*(client: Client) {.async.} =
295295
## Stop the client.
296-
client.ds.stop()
296+
await client.ds.stop()
297297
client.isRunning = false
298298
notice "Client stopped", client = client.getId()

src/chat/delivery/waku_client.nim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,6 @@ proc getConnectedPeerCount*(client: WakuClient): int =
206206
if peerInfo.connectedness == Connected:
207207
inc count
208208
return count
209+
210+
proc stop*(client: WakuClient) {.async.} =
211+
await client.node.stop()

0 commit comments

Comments
 (0)