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 e96f049
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion 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 @@ -85,6 +85,10 @@ mkManagerSettingsContext mcontext tls sock = defaultManagerSettings
tlsManagerSettings :: ManagerSettings
tlsManagerSettings = mkManagerSettings def Nothing

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

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

0 comments on commit e96f049

Please sign in to comment.