Skip to content
Create a gist now

Instantly share code, notes, and snippets.

HsOpenSSL: touch SSLContext on withSSL
diff --git a/OpenSSL/Session.hsc b/OpenSSL/Session.hsc
index de054fe..c4637e6 100644
--- a/OpenSSL/Session.hsc
+++ b/OpenSSL/Session.hsc
@@ -319,7 +319,9 @@ fdConnection :: SSLContext -> Fd -> IO SSL
fdConnection context fd = connection' context fd Nothing
withSSL :: SSL -> (Ptr SSL_ -> IO a) -> IO a
-withSSL = withMVar . sslMVar
+withSSL ssl f = do a <- withMVar (sslMVar ssl) f
+ touchContext (sslCtx ssl)
+ return a
foreign import ccall "SSL_accept" _ssl_accept :: Ptr SSL_ -> IO CInt
foreign import ccall "SSL_connect" _ssl_connect :: Ptr SSL_ -> IO CInt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.