aboutsummaryrefslogtreecommitdiff
path: root/Utility/Metered.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-11-03 20:36:11 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-11-03 22:11:47 -0400
commit8b10219d0e713ad1336b7de61017e7f20a468d91 (patch)
tree4cef7ee054cd57f01860f0efb8d992ad3dce7eeb /Utility/Metered.hs
parent1d8ed4ecd87822d468744dbd2a03c0931775c697 (diff)
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. (cherry picked from commit bd09046291a5fde26afc02f5838c6594c1fa9c00)
Diffstat (limited to 'Utility/Metered.hs')
-rw-r--r--Utility/Metered.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/Utility/Metered.hs b/Utility/Metered.hs
index 447eab2e8..f27eee26d 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