summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorEuan T <euantorano@users.noreply.github.com>2017-07-03 20:13:25 +0100
committerGitHub <noreply@github.com>2017-07-03 20:13:25 +0100
commita5681d03e38006655b2b6383253c701a8d5409f4 (patch)
treedc0ae5e8b462a1b8de4f60ec22ebaf7b25c915c4 /lib
parent9e12db445959ce7c791ec7480ea08e9e02f96bba (diff)
downloadNim-a5681d03e38006655b2b6383253c701a8d5409f4.tar.gz
Wait for reads to finish before reading the result
As requested by @dom96, this fixes an issue seen here: https://github.com/nim-lang/redis/pull/4#issuecomment-312713921
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/asyncnet.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/pure/asyncnet.nim b/lib/pure/asyncnet.nim
index 9f73bc3cf..f5c7b3e05 100644
--- a/lib/pure/asyncnet.nim
+++ b/lib/pure/asyncnet.nim
@@ -534,14 +534,14 @@ proc recvLineInto*(socket: AsyncSocket, resString: FutureVar[string],
     var c = ""
     while true:
       let recvFut = recv(socket, 1, flags)
-      c = recvFut.read()
+      c = await recvFut
       if c.len == 0:
         resString.mget.setLen(0)
         resString.complete()
         return
       if c == "\r":
         let recvFut = recv(socket, 1, flags) # Skip \L
-        c = recvFut.read()
+        c = await recvFut
         assert c == "\L"
         addNLIfEmpty()
         resString.complete()