summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2023-05-01 21:42:53 +0800
committerGitHub <noreply@github.com>2023-05-01 15:42:53 +0200
commitaec5a4c4744a81e19954daf330bafac948098835 (patch)
tree75d536ee60ed4dfc6e4d9f5b491dbcbc0b6b0b4e
parent8e0f336f6dab061bd4dd0a07f4b436bbbe78138d (diff)
downloadNim-aec5a4c4744a81e19954daf330bafac948098835.tar.gz
fixes #20144; fixes asyncnet ssl on bsds (#21763)
fixes asyncnet on bsds
-rw-r--r--lib/pure/asyncnet.nim7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/pure/asyncnet.nim b/lib/pure/asyncnet.nim
index d35dbdfaf..2fc8d366e 100644
--- a/lib/pure/asyncnet.nim
+++ b/lib/pure/asyncnet.nim
@@ -265,14 +265,17 @@ when defineSsl:
       ErrClearError()
       # Call the desired operation.
       opResult = op
-
+      let err =
+        if opResult < 0:
+          getSslError(socket, opResult.cint)
+        else:
+          SSL_ERROR_NONE
       # Send any remaining pending SSL data.
       await sendPendingSslData(socket, flags)
 
       # If the operation failed, try to see if SSL has some data to read
       # or write.
       if opResult < 0:
-        let err = getSslError(socket, opResult.cint)
         let fut = appeaseSsl(socket, flags, err.cint)
         yield fut
         if not fut.read():