Implemented default arguments for async procs.

This commit is contained in:
Dominik Picheta 2013-07-28 14:41:09 +01:00
commit 426c2d6c01
2 changed files with 35 additions and 28 deletions

View file

@ -1,6 +1,6 @@
import sockets, asyncio, strutils
proc processRequest(client: PAsyncSocket, test: string, closeSock: bool) {.async.} =
proc processRequest(client: PAsyncSocket, test: string, closeSock: bool = true) {.async.} =
assert test == "ahha"
assert client != nil
echo("Test = ", test)
@ -25,7 +25,7 @@ proc processServer() {.async.} =
let client: PAsyncSocket = await(accept(sock))
assert client != nil
await processRequest(client, "ahha", false)
await processRequest(client, "ahha", true)
await processRequest(client, "ahha")
var disp = newDispatcher(false)
disp.register(processServer, nil)