Deprecated asyncio module. Fixed old tests.
This commit is contained in:
parent
c35182aca7
commit
f972b464cb
3 changed files with 12 additions and 5 deletions
|
|
@ -47,7 +47,7 @@ proc serverAccept(s: PAsyncSocket) =
|
|||
proc launchSwarm(disp: var PDispatcher, port: TPort, count: int,
|
||||
buffered = true, useSSL = false) =
|
||||
for i in 1..count:
|
||||
var client = AsyncSocket()
|
||||
var client = asyncSocket()
|
||||
when defined(ssl):
|
||||
if useSSL:
|
||||
ctx1.wrapSocket(client)
|
||||
|
|
@ -56,7 +56,7 @@ proc launchSwarm(disp: var PDispatcher, port: TPort, count: int,
|
|||
client.connect("localhost", port)
|
||||
|
||||
proc createSwarm(port: TPort, buffered = true, useSSL = false) =
|
||||
var server = AsyncSocket()
|
||||
var server = asyncSocket()
|
||||
when defined(ssl):
|
||||
if useSSL:
|
||||
ctx.wrapSocket(server)
|
||||
|
|
|
|||
|
|
@ -42,14 +42,14 @@ proc swarmConnect(s: PAsyncSocket) =
|
|||
proc createClient(disp: var PDispatcher, port: TPort,
|
||||
buffered = true) =
|
||||
currentClient.inc()
|
||||
var client = AsyncSocket(typ = SOCK_DGRAM, protocol = IPPROTO_UDP,
|
||||
var client = asyncSocket(typ = SOCK_DGRAM, protocol = IPPROTO_UDP,
|
||||
buffered = buffered)
|
||||
client.handleConnect = swarmConnect
|
||||
disp.register(client)
|
||||
client.connect("localhost", port)
|
||||
|
||||
proc createServer(port: TPort, buffered = true) =
|
||||
var server = AsyncSocket(typ = SOCK_DGRAM, protocol = IPPROTO_UDP,
|
||||
var server = asyncSocket(typ = SOCK_DGRAM, protocol = IPPROTO_UDP,
|
||||
buffered = buffered)
|
||||
server.handleRead = serverRead
|
||||
disp.register(server)
|
||||
|
|
@ -75,4 +75,4 @@ while true:
|
|||
break
|
||||
|
||||
assert msgCount == messagesToSend * serverCount * swarmSize
|
||||
echo(msgCount)
|
||||
echo(msgCount)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue