on master help sign in
specifying buffer pool in WarpTLS.
commitc754e6c32ea7f08545de2ba7a96adc1cd7d499ee authorKazu Yamamoto <kazu@iij.ad.jp> dateThu 11 Jun 2015, 11:46 (11 years ago) parentdb94f79
2 files changed+7−3
warp-tls/Network/Wai/Handler/WarpTLS.hs+4−2 warp/Network/Wai/Handler/Warp.hs+3−1
warp-tls/Network/Wai/Handler/WarpTLS.hs+4−2
@@ -268,13 +268,14 @@ mkConn tlsset s params = do
268268
269269httpOverTls :: TLS.TLSParams params => TLSSettings -> Socket -> I.IORef B.ByteString -> params -> IO (Connection, Transport)
270270httpOverTls TLSSettings{..} s cachedRef params = do
271+ pool <- newBufferPool
271272 gen <- Crypto.Random.AESCtr.makeSystem
272273 ctx <- TLS.contextNew backend params gen
273274 TLS.contextHookSetLogging ctx tlsLogging
274275 TLS.handshake ctx
275276 writeBuf <- allocateBuffer bufferSize
276277 tls <- getTLSinfo ctx
277− return (conn ctx writeBuf, tls)
278+ return (conn ctx pool writeBuf, tls)
278279 where
279280 backend = TLS.Backend {
280281 TLS.backendFlush = return ()
@@ -282,13 +283,14 @@ httpOverTls TLSSettings{..} s cachedRef params = do
282283 , TLS.backendSend = sendAll s
283284 , TLS.backendRecv = recvTLS cachedRef s
284285 }
285− conn ctx writeBuf = Connection {
286+ conn ctx pool writeBuf = Connection {
286287 connSendMany = TLS.sendData ctx . L.fromChunks
287288 , connSendAll = TLS.sendData ctx . L.fromChunks . return
288289 , connSendFile = sendfile
289290 , connClose = close
290291 , connRecv = recv
291292 , connSendFileOverride = NotOverride
293+ , connBufferPool = pool
292294 , connWriteBuffer = writeBuf
293295 , connBufferSize = bufferSize
294296 }
warp/Network/Wai/Handler/Warp.hs+3−1
@@ -94,7 +94,8 @@ module Network.Wai.Handler.Warp (
9494 -- * Connection
9595 , Connection (..)
9696 , socketConnection
97− -- * Internal
97+ , newBufferPool
98+ -- * Internal
9899 -- ** Version
99100 , warpVersion
100101 -- ** Data types
@@ -113,6 +114,7 @@ module Network.Wai.Handler.Warp (
113114 , sendResponse
114115 ) where
115116
117+import Network.Wai.Handler.Warp.Buffer
116118import Network.Wai.Handler.Warp.Date
117119import Network.Wai.Handler.Warp.FdCache
118120import Network.Wai.Handler.Warp.Header