git.iko.soy/distributed-process
on master help sign in
smallChunkSize instead of 4kB to avoid overhead
commitac068d286194c5c9d1ae412bc18086be90cac3bc authorEdsko de Vries <edsko@edsko.net> dateTue 2 Oct 2012, 10:09 (14 years ago) parente7543a3
1 file changed+2−1
network-transport-tcp/src/Network/Transport/TCP/Internal.hs+2−1
network-transport-tcp/src/Network/Transport/TCP/Internal.hs+2−1
@@ -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))