mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-14 07:13:27 +00:00
Merge pull request #4758 from nigredo-tori/fix-asyncfd-send
Fix AsyncFD send
This commit is contained in:
@@ -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()
|
||||
Reference in New Issue
Block a user