From bd09046291a5fde26afc02f5838c6594c1fa9c00 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 3 Nov 2014 20:36:11 -0400 Subject: [PATCH] switch from hGetSome to hGet This should be essentially no-op change for hGetContentsMetered, since it always gets the entire contents. So the only difference is that each chunk of the lazy bytestring will always be the full chunk size. So, I'm pretty sure this is safe. Also, the only current users of hGetContentsMetered are reading files, so the stream won't block for long in the middle. The improvement is that hGetUntilMetered will always get some multiple of the defaultChunkSize. This will allow the S3 multipart code to pick a fixed size and know that hGetUntilMetered will really get that size. --- Utility/Metered.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utility/Metered.hs b/Utility/Metered.hs index 447eab2e89..f27eee26db 100644 --- a/Utility/Metered.hs +++ b/Utility/Metered.hs @@ -120,7 +120,7 @@ hGetUntilMetered h keepgoing meterupdate = lazyRead zeroBytesProcessed lazyRead sofar = unsafeInterleaveIO $ loop sofar loop sofar = do - c <- S.hGetSome h defaultChunkSize + c <- S.hGet h defaultChunkSize if S.null c then do hClose h