From 1ff985b468a3d6ebe1fe179b95879f1ef9865747 Mon Sep 17 00:00:00 2001 From: cheatfate Date: Tue, 12 Jun 2018 09:49:16 +0300 Subject: [PATCH] Fix for latest changes in asyncdispatch2. --- eth-rpc/server.nim | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/eth-rpc/server.nim b/eth-rpc/server.nim index 00ef4b8..782f658 100644 --- a/eth-rpc/server.nim +++ b/eth-rpc/server.nim @@ -80,8 +80,9 @@ proc sendError*(client: StreamTransport, code: int, msg: string, id: JsonNode, data: JsonNode = newJNull()) {.async.} = ## Send error message to client let error = %{"code": %(code), "message": %msg, "data": data} - ifDebug: echo "Send error json: ", wrapReply(newJNull(), error, id) - result = client.write(wrapReply(id, newJNull(), error)) + var res = wrapReply(id, newJNull(), error) + ifDebug: echo "Send error json: ", res + result = client.write(res) proc sendJsonError*(state: RpcJsonError, client: StreamTransport, id: JsonNode, data = newJNull()) {.async.} = @@ -110,7 +111,8 @@ proc processMessage(server: RpcServer, client: StreamTransport, %(methodName & " is not a registered method.")) else: let callRes = await server.procs[methodName](node["params"]) - discard await client.write(wrapReply(id, callRes, newJNull())) + var res = wrapReply(id, callRes, newJNull()) + discard await client.write(res) proc processClient(server: StreamServer, client: StreamTransport) {.async.} = var rpc = getUserData[RpcServer](server)