mirror of
https://github.com/logos-storage/nim-json-rpc.git
synced 2026-01-06 07:33:08 +00:00
Revert "Rename rpcstreamserver and newStreamServer to rpcsocketserver and newSocketServer"
This reverts commit 0dfb4be55c4cbf852370b50971ba89f6539bf921.
This commit is contained in:
parent
0dfb4be55c
commit
746232a928
@ -9,7 +9,7 @@ macro error(body: varargs[untyped]): untyped = newStmtList()
|
|||||||
|
|
||||||
type RpcStreamServer* = RpcServer[StreamServer]
|
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``.
|
## Create new server and assign it to addresses ``addresses``.
|
||||||
result = RpcServer[StreamServer]()
|
result = RpcServer[StreamServer]()
|
||||||
result.procs = newTable[string, RpcProc]()
|
result.procs = newTable[string, RpcProc]()
|
||||||
@ -28,7 +28,7 @@ proc newRpcSocketServer*(addresses: openarray[TransportAddress]): RpcStreamServe
|
|||||||
# Server was not bound, critical error.
|
# Server was not bound, critical error.
|
||||||
raise newException(RpcBindError, "Unable to create server!")
|
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``.
|
## Create new server and assign it to addresses ``addresses``.
|
||||||
var
|
var
|
||||||
tas4: seq[TransportAddress]
|
tas4: seq[TransportAddress]
|
||||||
@ -57,9 +57,9 @@ proc newRpcSocketServer*(addresses: openarray[string]): RpcServer[StreamServer]
|
|||||||
# Addresses could not be resolved, critical error.
|
# Addresses could not be resolved, critical error.
|
||||||
raise newException(RpcAddressUnresolvableError, "Unable to get address!")
|
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
|
var
|
||||||
tas4: seq[TransportAddress]
|
tas4: seq[TransportAddress]
|
||||||
tas6: seq[TransportAddress]
|
tas6: seq[TransportAddress]
|
||||||
@ -74,7 +74,7 @@ proc newRpcSocketServer*(address = "localhost", port: Port = Port(8545)): RpcSer
|
|||||||
try:
|
try:
|
||||||
tas6 = resolveTAddress(address, port, IpAddressFamily.IPv6)
|
tas6 = resolveTAddress(address, port, IpAddressFamily.IPv6)
|
||||||
except:
|
except:
|
||||||
error "Failed to create server for address", address = $item, errror = getCurrentException()
|
discard
|
||||||
|
|
||||||
if len(tas4) == 0 and len(tas6) == 0:
|
if len(tas4) == 0 and len(tas6) == 0:
|
||||||
# Address was not resolved, critical error.
|
# Address was not resolved, critical error.
|
||||||
@ -91,7 +91,7 @@ proc newRpcSocketServer*(address = "localhost", port: Port = Port(8545)): RpcSer
|
|||||||
udata = result)
|
udata = result)
|
||||||
result.servers.add(server)
|
result.servers.add(server)
|
||||||
except:
|
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:
|
for item in tas6:
|
||||||
try:
|
try:
|
||||||
@ -100,7 +100,7 @@ proc newRpcSocketServer*(address = "localhost", port: Port = Port(8545)): RpcSer
|
|||||||
udata = result)
|
udata = result)
|
||||||
result.servers.add(server)
|
result.servers.add(server)
|
||||||
except:
|
except:
|
||||||
error "Failed to create server for address", address = $item, errror = getCurrentException()
|
error "Failed to create server", address = $item
|
||||||
|
|
||||||
if len(result.servers) == 0:
|
if len(result.servers) == 0:
|
||||||
# Server was not bound, critical error.
|
# Server was not bound, critical error.
|
||||||
@ -3,10 +3,10 @@
|
|||||||
allow unchecked and unformatted calls.
|
allow unchecked and unformatted calls.
|
||||||
]#
|
]#
|
||||||
|
|
||||||
import unittest, debugclient, ../rpcsocketservers
|
import unittest, debugclient, ../rpcstreamservers
|
||||||
import strformat, chronicles
|
import strformat, chronicles
|
||||||
|
|
||||||
var server = newRpcSocketServer("localhost", 8547.Port)
|
var server = newRpcStreamServer("localhost", 8547.Port)
|
||||||
var client = newRpcClient()
|
var client = newRpcClient()
|
||||||
|
|
||||||
server.start()
|
server.start()
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import unittest, json, tables
|
import unittest, json, tables
|
||||||
import ../rpcclient, ../rpcsocketservers
|
import ../rpcclient, ../rpcstreamservers
|
||||||
import stint, ethtypes, ethprocs, stintjson, nimcrypto
|
import stint, ethtypes, ethprocs, stintjson, nimcrypto
|
||||||
|
|
||||||
from os import getCurrentDir, DirSep
|
from os import getCurrentDir, DirSep
|
||||||
@ -7,7 +7,7 @@ from strutils import rsplit
|
|||||||
template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]
|
template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]
|
||||||
|
|
||||||
var
|
var
|
||||||
server = newRpcSocketServer("localhost", Port(8546))
|
server = newRpcStreamServer("localhost", Port(8546))
|
||||||
client = newRpcClient()
|
client = newRpcClient()
|
||||||
|
|
||||||
## Generate Ethereum server RPCs
|
## Generate Ethereum server RPCs
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import unittest, json, tables
|
import unittest, json, tables
|
||||||
import ../rpcsocketservers
|
import ../rpcstreamservers
|
||||||
|
|
||||||
type
|
type
|
||||||
# some nested types to check object parsing
|
# some nested types to check object parsing
|
||||||
@ -27,7 +27,7 @@ let
|
|||||||
},
|
},
|
||||||
"c": %1.23}
|
"c": %1.23}
|
||||||
|
|
||||||
var s = newRpcSocketServer(["localhost:8545"])
|
var s = newRpcStreamServer(["localhost:8545"])
|
||||||
|
|
||||||
# RPC definitions
|
# RPC definitions
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import unittest, json
|
import unittest, json
|
||||||
import ../rpcclient, ../rpcsocketservers
|
import ../rpcclient, ../rpcstreamservers
|
||||||
|
|
||||||
var srv = newRpcSocketServer(["localhost:8545"])
|
var srv = newRpcStreamServer(["localhost:8545"])
|
||||||
var client = newRpcClient()
|
var client = newRpcClient()
|
||||||
|
|
||||||
# Create RPC on server
|
# Create RPC on server
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user