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)