File descriptors are now removed from fds list explicitly in close().

Fixes tasyncawait on linux.
This commit is contained in:
Dominik Picheta 2014-03-14 18:46:08 +00:00
commit 1a75b17cd0
3 changed files with 25 additions and 23 deletions

View file

@ -26,19 +26,19 @@ proc launchSwarm(disp: PDispatcher, port: TPort): PFuture[int] {.async.} =
discard await disp.connect(sock, "localhost", port)
when true:
discard await sendMessages(disp, sock)
sock.close()
disp.close(sock)
else:
# Issue #932: https://github.com/Araq/Nimrod/issues/932
var msgFut = sendMessages(disp, sock)
msgFut.callback =
proc () =
sock.close()
disp.close(sock)
proc readMessages(disp: PDispatcher, client: TSocketHandle): PFuture[int] {.async.} =
while true:
var line = await disp.recvLine(client)
if line == "":
client.close()
disp.close(client)
clientCount.inc
break
else: