diff options
author | Joey Hess <joey@kitenet.net> | 2012-11-18 15:27:44 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-11-18 15:27:44 -0400 |
commit | 677aab525a7023642f4b2e9d96db3c3481e8f0b1 (patch) | |
tree | e6584a8f1663f364001ad452fe8d09b83fda11a4 /Remote/Bup.hs | |
parent | cb2ec900ae8aa60b4ccf35adeb287823d976be07 (diff) |
better streaming while encrypting/decrypting
Both the directory and webdav special remotes used to have to buffer
the whole file contents before it could be decrypted, as they read
from chunks. Now the chunks are streamed through gpg with no buffering.
Diffstat (limited to 'Remote/Bup.hs')
-rw-r--r-- | Remote/Bup.hs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Remote/Bup.hs b/Remote/Bup.hs index f5bcc4f45..62db01a7b 100644 --- a/Remote/Bup.hs +++ b/Remote/Bup.hs @@ -125,7 +125,7 @@ storeEncrypted r buprepo (cipher, enck) k _p = do src <- inRepo $ gitAnnexLocation k params <- bupSplitParams r buprepo enck [] liftIO $ catchBoolIO $ - withEncryptedHandle cipher (L.readFile src) $ \h -> + encrypt cipher (feedFile src) $ \h -> pipeBup params (Just h) Nothing retrieve :: BupRepo -> Key -> AssociatedFile -> FilePath -> Annex Bool @@ -141,7 +141,8 @@ retrieveCheap _ _ _ = return False retrieveEncrypted :: BupRepo -> (Cipher, Key) -> Key -> FilePath -> Annex Bool retrieveEncrypted buprepo (cipher, enck) _ f = liftIO $ catchBoolIO $ withHandle StdoutHandle createProcessSuccess p $ \h -> do - withDecryptedContent cipher (L.hGetContents h) $ L.writeFile f + decrypt cipher (\toh -> L.hPut toh =<< L.hGetContents h) $ + readBytes $ L.writeFile f return True where params = bupParams "join" buprepo [Param $ bupRef enck] |