@@ -38,6 +38,7 @@ import Control.Applicative ((<$>))
3838import Data.ByteString (ByteString)
3939import qualified Data.ByteString as BS (length, concat, null)
4040import Data.Int (Int32)
41+import Data.ByteString.Lazy.Internal (smallChunkSize)
4142
4243-- | Start a server at the specified address.
4344--
@@ -115,7 +116,7 @@ recvExact sock len = go [] len
115116 go :: [ByteString] -> Int32 -> IO [ByteString]
116117 go acc 0 = return (reverse acc)
117118 go acc l = do
118− bs <- NBS.recv sock (fromIntegral l `min` 4096)
119+ bs <- NBS.recv sock (fromIntegral l `min` smallChunkSize)
119120 if BS.null bs
120121 then throwIO (userError "recvExact: Socket closed")
121122 else go (bs : acc) (l - fromIntegral (BS.length bs))