summaryrefslogtreecommitdiff
path: root/Remote/Rsync.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-11-18 15:27:44 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-11-18 15:27:44 -0400
commit677aab525a7023642f4b2e9d96db3c3481e8f0b1 (patch)
treee6584a8f1663f364001ad452fe8d09b83fda11a4 /Remote/Rsync.hs
parentcb2ec900ae8aa60b4ccf35adeb287823d976be07 (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/Rsync.hs')
-rw-r--r--Remote/Rsync.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/Remote/Rsync.hs b/Remote/Rsync.hs
index 1d5f2d28c..c48a9c14a 100644
--- a/Remote/Rsync.hs
+++ b/Remote/Rsync.hs
@@ -110,7 +110,8 @@ store o k _f p = rsyncSend o p k <=< inRepo $ gitAnnexLocation k
storeEncrypted :: RsyncOpts -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool
storeEncrypted o (cipher, enck) k p = withTmp enck $ \tmp -> do
src <- inRepo $ gitAnnexLocation k
- liftIO $ withEncryptedContent cipher (L.readFile src) $ L.writeFile tmp
+ liftIO $ decrypt cipher (feedFile src) $
+ readBytes $ L.writeFile tmp
rsyncSend o p enck tmp
retrieve :: RsyncOpts -> Key -> AssociatedFile -> FilePath -> Annex Bool
@@ -128,7 +129,8 @@ retrieveEncrypted :: RsyncOpts -> (Cipher, Key) -> Key -> FilePath -> Annex Bool
retrieveEncrypted o (cipher, enck) _ f = withTmp enck $ \tmp -> do
ifM (retrieve o enck undefined tmp)
( liftIO $ catchBoolIO $ do
- withDecryptedContent cipher (L.readFile tmp) $ L.writeFile f
+ decrypt cipher (feedFile tmp) $
+ readBytes $ L.writeFile f
return True
, return False
)