diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-12-07 13:37:35 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-12-07 13:37:35 -0400 |
commit | 1827d467395e66993b38c1b6269e4832abb3cc26 (patch) | |
tree | d52ae935aecc2425c5e4f8042c755ce11fcf6df0 /Utility | |
parent | a620b256aca3eee4ce2edae713d57965627f3ef7 (diff) |
update progress meter when sending to p2p remote
This commit was sponsored by Thom May on Patreon.
Diffstat (limited to 'Utility')
-rw-r--r-- | Utility/Metered.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Utility/Metered.hs b/Utility/Metered.hs index 440aa3f07..aa65efd4d 100644 --- a/Utility/Metered.hs +++ b/Utility/Metered.hs @@ -85,9 +85,12 @@ streamMeteredFile f meterupdate h = withMeteredFile f meterupdate $ L.hPut h {- Writes a ByteString to a Handle, updating a meter as it's written. -} meteredWrite :: MeterUpdate -> Handle -> L.ByteString -> IO () -meteredWrite meterupdate h = go zeroBytesProcessed . L.toChunks +meteredWrite meterupdate h = void . meteredWrite' meterupdate h + +meteredWrite' :: MeterUpdate -> Handle -> L.ByteString -> IO BytesProcessed +meteredWrite' meterupdate h = go zeroBytesProcessed . L.toChunks where - go _ [] = return () + go sofar [] = return sofar go sofar (c:cs) = do S.hPut h c let sofar' = addBytesProcessed sofar $ S.length c |