make tests green
This commit is contained in:
parent
bbb0fd4eb7
commit
d8fde9daba
6 changed files with 17 additions and 17 deletions
|
|
@ -12,11 +12,11 @@ const
|
|||
|
||||
var clientCount = 0
|
||||
|
||||
proc sendMessages(client: TAsyncFD) {.async.} =
|
||||
proc sendMessages(client: AsyncFD) {.async.} =
|
||||
for i in 0 .. <messagesToSend:
|
||||
await send(client, "Message " & $i & "\c\L")
|
||||
|
||||
proc launchSwarm(port: TPort) {.async.} =
|
||||
proc launchSwarm(port: Port) {.async.} =
|
||||
for i in 0 .. <swarmSize:
|
||||
var sock = newAsyncNativeSocket()
|
||||
|
||||
|
|
@ -24,7 +24,7 @@ proc launchSwarm(port: TPort) {.async.} =
|
|||
await sendMessages(sock)
|
||||
closeSocket(sock)
|
||||
|
||||
proc readMessages(client: TAsyncFD) {.async.} =
|
||||
proc readMessages(client: AsyncFD) {.async.} =
|
||||
while true:
|
||||
var line = await recvLine(client)
|
||||
if line == "":
|
||||
|
|
@ -37,7 +37,7 @@ proc readMessages(client: TAsyncFD) {.async.} =
|
|||
else:
|
||||
doAssert false
|
||||
|
||||
proc createServer(port: TPort) {.async.} =
|
||||
proc createServer(port: Port) {.async.} =
|
||||
var server = newAsyncNativeSocket()
|
||||
block:
|
||||
var name: Sockaddr_in
|
||||
|
|
@ -55,8 +55,8 @@ proc createServer(port: TPort) {.async.} =
|
|||
while true:
|
||||
asyncCheck readMessages(await accept(server))
|
||||
|
||||
asyncCheck createServer(TPort(10335))
|
||||
asyncCheck launchSwarm(TPort(10335))
|
||||
asyncCheck createServer(Port(10335))
|
||||
asyncCheck launchSwarm(Port(10335))
|
||||
while true:
|
||||
poll()
|
||||
if clientCount == swarmSize: break
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue