HsOpenSSL: touch SSLContext on withSSL

  • Download Gist
HsOpenSSL-touch-SSLContext-on-withSSL.patch
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.