Skip to content

Commit 76e65f4

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

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
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:

examples/tui/tui.nim

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,6 @@ proc getSelectedConvo(app: ChatApp): ptr ConvoInfo =
106106

107107
proc createChatClient(name: string): Future[Client] {.async.} =
108108
var cfg = await getCfg(name)
109-
# for key, val in fetchRegistrations():
110-
# if key != name:
111-
# cfg.waku.staticPeers.add(val)
112-
113109
result = newClient(cfg.waku, cfg.ident)
114110

115111

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)