From 0f78f197eb87482aa25196e64eacf132570f9dc6 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 3 Nov 2014 21:02:44 -0400 Subject: [PATCH] casts; now fully working.. but still leaking Still seems to buffer the whole partsize in memory, but I'm pretty sure my code is not what's doing it. See https://github.com/aristidb/aws/issues/142 --- Remote/S3.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Remote/S3.hs b/Remote/S3.hs index 9184e0698c..b105855151 100644 --- a/Remote/S3.hs +++ b/Remote/S3.hs @@ -183,7 +183,7 @@ store r h = fileStorer $ \k f p -> do -- The actual part size will be a even multiple of the -- 32k chunk size that hGetUntilMetered uses. - let partsz' = (partsz `div` defaultChunkSize) * defaultChunkSize + let partsz' = (partsz `div` toInteger defaultChunkSize) * toInteger defaultChunkSize -- Send parts of the file, taking care to stream each part -- w/o buffering in memory, since the parts can be large. @@ -198,7 +198,7 @@ store r h = fileStorer $ \k f p -> do then fsz - pos else partsz' b <- liftIO $ hGetUntilMetered fh (< partsz') meter - let body = RequestBodyStream sz (mkPopper b) + let body = RequestBodyStream (fromIntegral sz) (mkPopper b) S3.UploadPartResponse _ etag <- sendS3Handle h $ S3.uploadPart (bucket info) object partnum uploadid body sendparts (offsetMeterUpdate meter (toBytesProcessed sz)) (etag:etags) (partnum + 1)