gnutls 0.1.4 → 0.1.5
raw patch · 2 files changed
+13/−15 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- gnutls.cabal +6/−6
- lib/Network/Protocol/TLS/GNU.hs +7/−9
gnutls.cabal view
@@ -1,5 +1,5 @@ name: gnutls-version: 0.1.4+version: 0.1.5 license: GPL-3 license-file: license.txt author: John Millikin <jmillikin@gmail.com>@@ -20,13 +20,13 @@ will be released at a later date. source-repository head- type: bazaar- location: https://john-millikin.com/branches/haskell-gnutls/0.1/+ type: git+ location: https://john-millikin.com/code/haskell-gnutls/ source-repository this- type: bazaar- location: https://john-millikin.com/branches/haskell-gnutls/0.1/- tag: haskell-gnutls_0.1.4+ type: git+ location: https://john-millikin.com/code/haskell-gnutls/+ tag: haskell-gnutls_0.1.5 library hs-source-dirs: lib
lib/Network/Protocol/TLS/GNU.hs view
@@ -68,20 +68,17 @@ {-# NOINLINE globalInitMVar #-} globalInitMVar = unsafePerformIO $ M.newMVar () -newtype GlobalState = GlobalState (F.ForeignPtr ())--globalInit :: ErrorT Error IO GlobalState+globalInit :: ErrorT Error IO () globalInit = do let init_ = M.withMVar globalInitMVar $ \_ -> F.gnutls_global_init- let deinit = M.withMVar globalInitMVar $ \_ -> F.gnutls_global_deinit F.ReturnCode rc <- liftIO init_ when (rc < 0) $ E.throwError $ mapError rc- fp <- liftIO $ FC.newForeignPtr F.nullPtr deinit- return $ GlobalState fp +globalDeinit :: IO ()+globalDeinit = M.withMVar globalInitMVar $ \_ -> F.gnutls_global_deinit+ data Session = Session { sessionPtr :: F.ForeignPtr F.Session- , sessionGlobalState :: GlobalState -- TLS credentials are not copied into the gnutls session struct, -- so pointers to them must be kept alive until the credentials@@ -122,7 +119,7 @@ newSession :: Transport -> F.ConnectionEnd -> IO (Either Error Session) newSession transport end = F.alloca $ \sPtr -> runErrorT $ do- global <- globalInit+ globalInit F.ReturnCode rc <- liftIO $ F.gnutls_init sPtr end when (rc < 0) $ E.throwError $ mapError rc liftIO $ do@@ -136,9 +133,10 @@ creds <- newIORef [] fp <- FC.newForeignPtr ptr $ do F.gnutls_deinit session+ globalDeinit F.freeHaskellFunPtr push F.freeHaskellFunPtr pull- return (Session fp global creds)+ return (Session fp creds) getSession :: TLS Session getSession = TLS R.ask