From d810b4515eb3f9b04a4d2b95b9951bc967d354ef Mon Sep 17 00:00:00 2001 From: Dmitry Polienko Date: Mon, 12 Sep 2016 22:42:12 -0700 Subject: [PATCH 1/3] Fix AsyncSocket send --- lib/pure/asyncdispatch.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pure/asyncdispatch.nim b/lib/pure/asyncdispatch.nim index 33b600718d..f8d079f70c 100644 --- a/lib/pure/asyncdispatch.nim +++ b/lib/pure/asyncdispatch.nim @@ -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: From a2a5985a2dd47ed591b6a6617650a530ce3cd23d Mon Sep 17 00:00:00 2001 From: Dmitry Polienko Date: Tue, 13 Sep 2016 02:00:37 -0700 Subject: [PATCH 2/3] Add test for issue #4757 --- tests/async/tasyncsend4757.nim | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/async/tasyncsend4757.nim diff --git a/tests/async/tasyncsend4757.nim b/tests/async/tasyncsend4757.nim new file mode 100644 index 0000000000..2ae4a6151d --- /dev/null +++ b/tests/async/tasyncsend4757.nim @@ -0,0 +1,16 @@ +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" + +asyncCheck f() + +poll(1000) From 191ff51859250f55d381ca712af67d824d0c9cc4 Mon Sep 17 00:00:00 2001 From: Dmitry Polienko Date: Tue, 13 Sep 2016 02:40:48 -0700 Subject: [PATCH 3/3] Fix tasyncsend4757 test (Linux) --- tests/async/tasyncsend4757.nim | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/async/tasyncsend4757.nim b/tests/async/tasyncsend4757.nim index 2ae4a6151d..1066f38e56 100644 --- a/tests/async/tasyncsend4757.nim +++ b/tests/async/tasyncsend4757.nim @@ -11,6 +11,4 @@ proc f(): Future[void] {.async.} = await s.send("123") echo "Finished" -asyncCheck f() - -poll(1000) +waitFor f()