Skip to content

Commit

Permalink
Check for errors after sendPendingSslData (nim-lang#16696)
Browse files Browse the repository at this point in the history
* Check for errors after sendPendingSslData

* Leftover comment removed
  • Loading branch information
yglukhov authored Jan 13, 2021
1 parent b727217 commit 165d397
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/pure/asyncnet.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 165d397

Please sign in to comment.