Skip to content

Commit 165d397

Browse files
authored
Check for errors after sendPendingSslData (#16696)
* Check for errors after sendPendingSslData * Leftover comment removed
1 parent b727217 commit 165d397

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

lib/pure/asyncnet.nim

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,9 @@ when defineSsl:
259259
ErrClearError()
260260
# Call the desired operation.
261261
opResult = op
262-
# Bit hackish here.
263-
# TODO: Introduce an async template transformation pragma?
264262

265263
# Send any remaining pending SSL data.
266-
yield sendPendingSslData(socket, flags)
264+
await sendPendingSslData(socket, flags)
267265

268266
# If the operation failed, try to see if SSL has some data to read
269267
# or write.
@@ -321,10 +319,8 @@ template readInto(buf: pointer, size: int, socket: AsyncSocket,
321319
sslRead(socket.sslHandle, cast[cstring](buf), size.cint))
322320
res = opResult
323321
else:
324-
var recvIntoFut = asyncdispatch.recvInto(socket.fd.AsyncFD, buf, size, flags)
325-
yield recvIntoFut
326322
# Not in SSL mode.
327-
res = recvIntoFut.read()
323+
res = await asyncdispatch.recvInto(socket.fd.AsyncFD, buf, size, flags)
328324
res
329325

330326
template readIntoBuf(socket: AsyncSocket,

0 commit comments

Comments
 (0)