Implemented genSym for async function calls.
This commit is contained in:
parent
adc74f8ab0
commit
2330c95b22
2 changed files with 36 additions and 17 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import sockets, asyncio, strutils
|
||||
|
||||
proc processRequest(client: PAsyncSocket, test: string) {.async.} =
|
||||
proc processRequest(client: PAsyncSocket, test: string, closeSock: bool) {.async.} =
|
||||
assert test == "ahha"
|
||||
assert client != nil
|
||||
echo("Test = ", test)
|
||||
|
|
@ -8,9 +8,10 @@ proc processRequest(client: PAsyncSocket, test: string) {.async.} =
|
|||
echo("Read: ", line)
|
||||
|
||||
await send(client, "Goodbye.\c\L")
|
||||
await send(client, "Goodbye.\c\L")
|
||||
await send(client, "Goodbye.\c\L")
|
||||
client.close()
|
||||
#await send(client, "Goodbye.\c\L")
|
||||
#await send(client, "Goodbye.\c\L")
|
||||
if closeSock:
|
||||
client.close()
|
||||
|
||||
proc processServer() {.async.} =
|
||||
var sock = AsyncSocket()
|
||||
|
|
@ -23,7 +24,8 @@ proc processServer() {.async.} =
|
|||
while true:
|
||||
let client: PAsyncSocket = await(accept(sock))
|
||||
assert client != nil
|
||||
await processRequest(client, "ahha")
|
||||
await processRequest(client, "ahha", false)
|
||||
await processRequest(client, "ahha", true)
|
||||
|
||||
var disp = newDispatcher(false)
|
||||
disp.register(processServer, nil)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue