fix some problems raised by Nim 0.20.2

This commit is contained in:
Ștefan Talpalaru 2019-07-19 11:12:25 +02:00 committed by zah
parent 3b02cbd946
commit 8168fcea25
3 changed files with 7 additions and 6 deletions

View File

@ -52,7 +52,7 @@ macro checkGet(node: JsonNode, fieldName: string,
of JObject: result.add(quote do: `n`.getObject)
else: discard
proc processMessage*(self: RpcClient, line: string) =
proc processMessage*(self: RpcClient, line: string) {.gcsafe.} =
# Note: this doesn't use any transport code so doesn't need to be
# differentiated.
let node = parseJson(line)
@ -82,9 +82,10 @@ proc processMessage*(self: RpcClient, line: string) =
elif "method" in node:
# This could be subscription notification
let name = node["method"].getStr()
let handler = self.methodHandlers.getOrDefault(name)
if not handler.isNil:
handler(node{"params"})
{.gcsafe.}:
let handler = self.methodHandlers.getOrDefault(name)
if not handler.isNil:
handler(node{"params"})
else:
raise newException(ValueError, "Invalid jsonrpc message: " & $node)

View File

@ -172,7 +172,7 @@ proc httpMethod*(client: RpcHttpClient, m: HttpMethod) =
client.options.httpMethod = m
method call*(client: RpcHttpClient, name: string,
params: JsonNode): Future[Response] {.async.} =
params: JsonNode): Future[Response] {.async, gcsafe.} =
## Remotely calls the specified RPC method.
let id = client.getNextId()

View File

@ -1,4 +1,4 @@
import ../client, chronos, tables, json
import ../client, chronos, tables, json, strtabs
const newsUseChronos = true
include news