Add rpc server init proc

This commit is contained in:
coffeepots 2018-06-15 11:12:34 +01:00
parent 746232a928
commit bdf47fd2ed
2 changed files with 6 additions and 3 deletions

View File

@ -58,6 +58,11 @@ const
(INVALID_REQUEST, "No id specified")
]
proc newRpcServer*[T]: RpcServer[T] =
result = RpcServer[T]()
result.procs = newTable[string, RpcProc]()
result.servers = @[]
# Utility functions
# TODO: Move outside server
func `%`*(p: Port): JsonNode = %(p.int)

View File

@ -11,9 +11,7 @@ type RpcStreamServer* = RpcServer[StreamServer]
proc newRpcStreamServer*(addresses: openarray[TransportAddress]): RpcStreamServer =
## Create new server and assign it to addresses ``addresses``.
result = RpcServer[StreamServer]()
result.procs = newTable[string, RpcProc]()
result.servers = newSeq[StreamServer]()
result = newRpcServer[StreamServer]()
for item in addresses:
try: