Merge pull request #4758 from nigredo-tori/fix-asyncfd-send
Fix AsyncFD send
This commit is contained in:
commit
99d9526002
2 changed files with 15 additions and 1 deletions
|
|
@ -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:
|
||||
|
|
|
|||
14
tests/async/tasyncsend4757.nim
Normal file
14
tests/async/tasyncsend4757.nim
Normal 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()
|
||||
Loading…
Add table
Add a link
Reference in a new issue