Rebrand asyncdispatch2 to chronos (#50)

This commit is contained in:
Mamy Ratsimbazafy 2019-02-06 18:27:58 +01:00 committed by GitHub
parent 1083b2972a
commit 53ed44dfa5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 14 additions and 14 deletions

View File

@ -332,7 +332,7 @@ The `call` procedure takes care of the basic format of the JSON to send to the s
However you still need to provide `params` as a `JsonNode`, which must exactly match the parameters defined in the equivalent `rpc` definition.
```nim
import json_rpc/[rpcclient, rpcserver], asyncdispatch2, json
import json_rpc/[rpcclient, rpcserver], chronos, json
var
server = newRpcSocketServer("localhost", Port(8545))

View File

@ -9,7 +9,7 @@ skipDirs = @["tests"]
requires "nim >= 0.17.3",
"nimcrypto",
"stint",
"asyncdispatch2",
"chronos",
"httputils",
"chronicles"

View File

@ -1,8 +1,8 @@
import tables, json, macros
import asyncdispatch2
import chronos
from strutils import toLowerAscii
import jsonmarshal
export asyncdispatch2
export chronos
type
ClientId* = int64
@ -55,7 +55,7 @@ proc processMessage*[T: RpcClient](self: T, line: string) =
if not self.awaiting.hasKey(id):
raise newException(ValueError,
"Cannot find message id \"" & node["id"].str & "\"")
let version = checkGet(node, "jsonrpc", JString)
if version != "2.0":
self.awaiting[id].asyncRaise(ValueError,

View File

@ -1,5 +1,5 @@
import json, strutils, tables
import chronicles, httputils, asyncdispatch2
import chronicles, httputils, chronos
import ../client
logScope:

View File

@ -1,4 +1,4 @@
import ../client, asyncdispatch2, tables, json
import ../client, chronos, tables, json
type
RpcSocketClient* = ref object of RpcClient

View File

@ -1,7 +1,7 @@
import
json, tables, asyncdispatch2, jsonmarshal, strutils, macros,
json, tables, chronos, jsonmarshal, strutils, macros,
chronicles, options
export asyncdispatch2, json, jsonmarshal
export chronos, json, jsonmarshal
type
RpcJsonError* = enum rjeInvalidJson, rjeVersionError, rjeNoMethod, rjeNoId, rjeNoParams
@ -9,7 +9,7 @@ type
# Procedure signature accepted as an RPC call by server
RpcProc* = proc(input: JsonNode): Future[JsonNode] {.gcsafe.}
RpcProcError* = ref object of Exception
code*: int
data*: JsonNode
@ -147,7 +147,7 @@ proc route*(router: RpcRouter, data: string): Future[string] {.async, gcsafe.} =
# const error code and message
errKind = jsonErrorMessages[errState.err]
# pass on the actual error message
fullMsg = errKind[1] & " " & errState[1]
fullMsg = errKind[1] & " " & errState[1]
res = wrapError(code = errKind[0], msg = fullMsg, id = id)
# return error state as json
result = $res & messageTerminator

View File

@ -1,8 +1,8 @@
import json, tables, options, macros
import asyncdispatch2, router, chronicles
import chronos, router, chronicles
import jsonmarshal
export asyncdispatch2, json, jsonmarshal, router, chronicles
export chronos, json, jsonmarshal, router, chronicles
type
RpcServer* = ref object of RootRef

View File

@ -1,5 +1,5 @@
import json, strutils
import chronicles, httputils, asyncdispatch2
import chronicles, httputils, chronos
import ../server
logScope: