@@ -24,6 +24,7 @@ import Network.Wai.Handler.Warp.Response
2424import Network.Wai.Handler.Warp.Settings
2525import qualified Network.Wai.Handler.Warp.Timeout as T
2626import Network.Wai.Handler.Warp.Types
27+import Network.Wai.Handler.Warp.Recv
2728
2829#if WINDOWS
2930import qualified Control.Concurrent.MVar as MV
@@ -44,13 +45,13 @@ bytesPerRead :: Int
4445bytesPerRead = 4096
4546
4647-- | Default action value for 'Connection'
47−socketConnection :: Socket -> Connection
48−socketConnection s = Connection
48+socketConnection :: Socket -> ReceiveBuffer -> Connection
49+socketConnection s buf = Connection
4950 { connSendMany = Sock.sendMany s
5051 , connSendAll = Sock.sendAll s
5152 , connSendFile = sendFile s
5253 , connClose = sClose s
53− , connRecv = Sock.recv s bytesPerRead
54+ , connRecv = receive s buf bytesPerRead
5455 }
5556
5657sendFile :: Socket -> FilePath -> Integer -> Integer -> IO () -> [ByteString] -> Cleaner -> IO ()
@@ -110,8 +111,9 @@ runSettingsSocket set socket app =
110111 where
111112 getter = do
112113 (conn, sa) <- accept socket
114+ buf <- allocateRecvBuffer bytesPerRead
113115 setSocketCloseOnExec socket
114− return (socketConnection conn, sa)
116+ return (socketConnection conn buf, sa)
115117
116118runSettingsConnection :: Settings -> IO (Connection, SockAddr) -> Application -> IO ()
117119runSettingsConnection set getConn app = runSettingsConnectionMaker set getConnMaker app