mirror of
https://github.com/logos-storage/nim-json-rpc.git
synced 2026-01-04 22:53:07 +00:00
Add close() procedure for RpcServer.
Fixed tests to stop/close server.
This commit is contained in:
parent
cbfe945fff
commit
aea1798897
@ -165,6 +165,11 @@ proc stop*(server: RpcServer) =
|
||||
for item in server.servers:
|
||||
item.stop()
|
||||
|
||||
proc close*(server: RpcServer) =
|
||||
## Cleanup resources of RPC server.
|
||||
for item in server.servers:
|
||||
item.close()
|
||||
|
||||
# Server registration and RPC generation
|
||||
|
||||
proc register*(server: RpcServer, name: string, rpc: RpcProc) =
|
||||
|
||||
@ -72,3 +72,6 @@ suite "Generated from signatures":
|
||||
check sigResults[0] == "Nimbus-RPC-Test"
|
||||
test "SHA3":
|
||||
check sigResults[1] == "0x47173285A8D7341E5E972FC677286384F802F8EF42A5EC5F03BBFA254CB01FAD"
|
||||
|
||||
server.stop()
|
||||
server.close()
|
||||
|
||||
@ -132,3 +132,6 @@ suite "Server types":
|
||||
# wrong param type
|
||||
let res = waitFor rpcDifferentParams(%[%"abc", %1])
|
||||
# TODO: When errors are proper return values, check error for param name
|
||||
|
||||
s.stop()
|
||||
s.close()
|
||||
@ -15,4 +15,7 @@ waitFor client.connect("localhost", Port(8545))
|
||||
suite "Server/Client RPC":
|
||||
test "Custom RPC":
|
||||
var r = waitFor client.call("myProc", %[%"abc", %[1, 2, 3, 4]])
|
||||
check r.result.getStr == "Hello abc data: [1, 2, 3, 4]"
|
||||
check r.result.getStr == "Hello abc data: [1, 2, 3, 4]"
|
||||
|
||||
srv.stop()
|
||||
srv.close()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user