diff --git a/rpcsocketservers.nim b/rpcstreamservers.nim similarity index 87% rename from rpcsocketservers.nim rename to rpcstreamservers.nim index c1c7aae..13f6cc6 100644 --- a/rpcsocketservers.nim +++ b/rpcstreamservers.nim @@ -9,7 +9,7 @@ macro error(body: varargs[untyped]): untyped = newStmtList() type RpcStreamServer* = RpcServer[StreamServer] -proc newRpcSocketServer*(addresses: openarray[TransportAddress]): RpcStreamServer = +proc newRpcStreamServer*(addresses: openarray[TransportAddress]): RpcStreamServer = ## Create new server and assign it to addresses ``addresses``. result = RpcServer[StreamServer]() result.procs = newTable[string, RpcProc]() @@ -28,7 +28,7 @@ proc newRpcSocketServer*(addresses: openarray[TransportAddress]): RpcStreamServe # Server was not bound, critical error. raise newException(RpcBindError, "Unable to create server!") -proc newRpcSocketServer*(addresses: openarray[string]): RpcServer[StreamServer] = +proc newRpcStreamServer*(addresses: openarray[string]): RpcServer[StreamServer] = ## Create new server and assign it to addresses ``addresses``. var tas4: seq[TransportAddress] @@ -57,9 +57,9 @@ proc newRpcSocketServer*(addresses: openarray[string]): RpcServer[StreamServer] # Addresses could not be resolved, critical error. raise newException(RpcAddressUnresolvableError, "Unable to get address!") - result = newRpcSocketServer(baddrs) + result = newRpcStreamServer(baddrs) -proc newRpcSocketServer*(address = "localhost", port: Port = Port(8545)): RpcServer[StreamServer] = +proc newRpcStreamServer*(address = "localhost", port: Port = Port(8545)): RpcServer[StreamServer] = var tas4: seq[TransportAddress] tas6: seq[TransportAddress] @@ -74,7 +74,7 @@ proc newRpcSocketServer*(address = "localhost", port: Port = Port(8545)): RpcSer try: tas6 = resolveTAddress(address, port, IpAddressFamily.IPv6) except: - error "Failed to create server for address", address = $item, errror = getCurrentException() + discard if len(tas4) == 0 and len(tas6) == 0: # Address was not resolved, critical error. @@ -91,7 +91,7 @@ proc newRpcSocketServer*(address = "localhost", port: Port = Port(8545)): RpcSer udata = result) result.servers.add(server) except: - error "Failed to create server for address", address = $item, errror = getCurrentException() + error "Failed to create server for address", address = $item for item in tas6: try: @@ -100,7 +100,7 @@ proc newRpcSocketServer*(address = "localhost", port: Port = Port(8545)): RpcSer udata = result) result.servers.add(server) except: - error "Failed to create server for address", address = $item, errror = getCurrentException() + error "Failed to create server", address = $item if len(result.servers) == 0: # Server was not bound, critical error. diff --git a/tests/testerrors.nim b/tests/testerrors.nim index 95acfbb..1887872 100644 --- a/tests/testerrors.nim +++ b/tests/testerrors.nim @@ -3,10 +3,10 @@ allow unchecked and unformatted calls. ]# -import unittest, debugclient, ../rpcsocketservers +import unittest, debugclient, ../rpcstreamservers import strformat, chronicles -var server = newRpcSocketServer("localhost", 8547.Port) +var server = newRpcStreamServer("localhost", 8547.Port) var client = newRpcClient() server.start() diff --git a/tests/testethcalls.nim b/tests/testethcalls.nim index 6f2c7e2..702d3d6 100644 --- a/tests/testethcalls.nim +++ b/tests/testethcalls.nim @@ -1,5 +1,5 @@ import unittest, json, tables -import ../rpcclient, ../rpcsocketservers +import ../rpcclient, ../rpcstreamservers import stint, ethtypes, ethprocs, stintjson, nimcrypto from os import getCurrentDir, DirSep @@ -7,7 +7,7 @@ from strutils import rsplit template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0] var - server = newRpcSocketServer("localhost", Port(8546)) + server = newRpcStreamServer("localhost", Port(8546)) client = newRpcClient() ## Generate Ethereum server RPCs diff --git a/tests/testrpcmacro.nim b/tests/testrpcmacro.nim index eab8553..b8bcb70 100644 --- a/tests/testrpcmacro.nim +++ b/tests/testrpcmacro.nim @@ -1,5 +1,5 @@ import unittest, json, tables -import ../rpcsocketservers +import ../rpcstreamservers type # some nested types to check object parsing @@ -27,7 +27,7 @@ let }, "c": %1.23} -var s = newRpcSocketServer(["localhost:8545"]) +var s = newRpcStreamServer(["localhost:8545"]) # RPC definitions diff --git a/tests/testserverclient.nim b/tests/testserverclient.nim index 10e8665..4c8f8be 100644 --- a/tests/testserverclient.nim +++ b/tests/testserverclient.nim @@ -1,7 +1,7 @@ import unittest, json -import ../rpcclient, ../rpcsocketservers +import ../rpcclient, ../rpcstreamservers -var srv = newRpcSocketServer(["localhost:8545"]) +var srv = newRpcStreamServer(["localhost:8545"]) var client = newRpcClient() # Create RPC on server