summary refs log tree commit diff stats
path: root/lib/pure/asyncnet.nim
diff options
context:
space:
mode:
authorYuriy Glukhov <yglukhov@users.noreply.github.com>2021-01-13 16:09:28 +0200
committerGitHub <noreply@github.com>2021-01-13 15:09:28 +0100
commit165d39738def9264156da9309e1d4c524fe499c8 (patch)
tree2e0e0d97f4d76a6a2f5cd17ceb626b45eb63a574 /lib/pure/asyncnet.nim
parentb727217229c0d3040db463705545cdb6b1e5769b (diff)
downloadNim-165d39738def9264156da9309e1d4c524fe499c8.tar.gz
Check for errors after sendPendingSslData (#16696)
* Check for errors after sendPendingSslData

* Leftover comment removed
Diffstat (limited to 'lib/pure/asyncnet.nim')
-rw-r--r--lib/pure/asyncnet.nim8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/pure/asyncnet.nim b/lib/pure/asyncnet.nim
index 455efe1c1..b68fa533f 100644
--- a/lib/pure/asyncnet.nim
+++ b/lib/pure/asyncnet.nim
@@ -259,11 +259,9 @@ when defineSsl:
       ErrClearError()
       # Call the desired operation.
       opResult = op
-      # Bit hackish here.
-      # TODO: Introduce an async template transformation pragma?
 
       # Send any remaining pending SSL data.
-      yield sendPendingSslData(socket, flags)
+      await sendPendingSslData(socket, flags)
 
       # If the operation failed, try to see if SSL has some data to read
       # or write.
@@ -321,10 +319,8 @@ template readInto(buf: pointer, size: int, socket: AsyncSocket,
         sslRead(socket.sslHandle, cast[cstring](buf), size.cint))
       res = opResult
   else:
-    var recvIntoFut = asyncdispatch.recvInto(socket.fd.AsyncFD, buf, size, flags)
-    yield recvIntoFut
     # Not in SSL mode.
-    res = recvIntoFut.read()
+    res = await asyncdispatch.recvInto(socket.fd.AsyncFD, buf, size, flags)
   res
 
 template readIntoBuf(socket: AsyncSocket,