File descriptors are now removed from fds list explicitly in close().
Fixes tasyncawait on linux.
This commit is contained in:
parent
3e056afb1c
commit
1a75b17cd0
3 changed files with 25 additions and 23 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue