Merge pull request #4758 from nigredo-tori/fix-asyncfd-send

Fix AsyncFD send
This commit is contained in:
Andreas Rumpf
2016-09-13 12:40:38 +02:00
committed by GitHub
2 changed files with 15 additions and 1 deletions

View File

@@ -1589,7 +1589,7 @@ proc send*(socket: AsyncFD, data: string,
# or failed.
let sendFut = socket.send(addr copiedData[0], data.len, flags)
sendFut.cb =
sendFut.callback =
proc () =
GC_unref(copiedData)
if sendFut.failed:

View File

@@ -0,0 +1,14 @@
discard """
file: "tasyncsend4754.nim"
output: "Finished"
"""
import asyncdispatch
proc f(): Future[void] {.async.} =
let s = newAsyncNativeSocket()
await s.connect("example.com", 80.Port)
await s.send("123")
echo "Finished"
waitFor f()