From 1f5d994700af4ef3176e1c550909cf04d7dc4ea8 Mon Sep 17 00:00:00 2001 From: cheatfate Date: Tue, 24 Mar 2020 09:48:05 +0200 Subject: [PATCH] Fix compilation errors introduced by latest chronos. --- libp2p/daemon/daemonapi.nim | 2 +- libp2p/protocols/pubsub/pubsub.nim | 2 +- libp2p/stream/bufferstream.nim | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libp2p/daemon/daemonapi.nim b/libp2p/daemon/daemonapi.nim index f2b238159..8e611d3f1 100644 --- a/libp2p/daemon/daemonapi.nim +++ b/libp2p/daemon/daemonapi.nim @@ -545,7 +545,7 @@ proc getSocket(pattern: string, closeSocket(sock) # This is forward declaration needed for newDaemonApi() -proc listPeers*(api: DaemonAPI): Future[seq[PeerInfo]] {.async.} +proc listPeers*(api: DaemonAPI): Future[seq[PeerInfo]] {.async, gcsafe.} proc copyEnv(): StringTableRef = ## This procedure copy all environment variables into StringTable. diff --git a/libp2p/protocols/pubsub/pubsub.nim b/libp2p/protocols/pubsub/pubsub.nim index 09b3c3ac4..9285ae93b 100644 --- a/libp2p/protocols/pubsub/pubsub.nim +++ b/libp2p/protocols/pubsub/pubsub.nim @@ -26,7 +26,7 @@ type data: seq[byte]): Future[void] {.gcsafe.} ValidatorHandler* = proc(topic: string, - message: Message): Future[bool] {.closure.} + message: Message): Future[bool] {.gcsafe, closure.} TopicPair* = tuple[topic: string, handler: TopicHandler] diff --git a/libp2p/stream/bufferstream.nim b/libp2p/stream/bufferstream.nim index d56a969a8..14daaf829 100644 --- a/libp2p/stream/bufferstream.nim +++ b/libp2p/stream/bufferstream.nim @@ -38,7 +38,7 @@ const DefaultBufferSize* = 1024 type # TODO: figure out how to make this generic to avoid casts - WriteHandler* = proc (data: seq[byte]): Future[void] + WriteHandler* = proc (data: seq[byte]): Future[void] {.gcsafe.} BufferStream* = ref object of LPStream maxSize*: int # buffer's max size in bytes @@ -335,7 +335,7 @@ proc pipe*(s: BufferStream, s.isPiped = true let oldHandler = target.writeHandler - proc handler(data: seq[byte]) {.async, closure.} = + proc handler(data: seq[byte]) {.async, closure, gcsafe.} = if not isNil(oldHandler): await oldHandler(data)