Skip to content

Commit

Permalink
Introduce global connection context #214
Browse files Browse the repository at this point in the history
  • Loading branch information
snoyberg committed Sep 15, 2016
1 parent 5cf3bd0 commit 1848e64
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions http-client-tls/Network/HTTP/Client/TLS.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import Data.ByteArray.Encoding (convertToBase, Base (Base16))
mkManagerSettings :: NC.TLSSettings
-> Maybe NC.SockSettings
-> ManagerSettings
mkManagerSettings = mkManagerSettingsContext Nothing
mkManagerSettings = mkManagerSettingsContext (Just globalContext)

-- | Same as 'mkManagerSettings', but also takes an optional
-- 'NC.ConnectionContext'. Providing this externally can be an
Expand Down Expand Up @@ -83,7 +83,11 @@ mkManagerSettingsContext mcontext tls sock = defaultManagerSettings

-- | Default TLS-enabled manager settings
tlsManagerSettings :: ManagerSettings
tlsManagerSettings = mkManagerSettings def Nothing
tlsManagerSettings = mkManagerSettingsContext (Just globalContext) def Nothing

globalContext :: NC.ConnectionContext
globalContext = unsafePerformIO NC.initConnectionContext
{-# NOINLINE globalContext #-}

getTlsConnection :: Maybe NC.ConnectionContext
-> Maybe NC.TLSSettings
Expand Down

0 comments on commit 1848e64

Please sign in to comment.