summaryrefslogtreecommitdiff
path: root/Remote/Helper
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-07-16 15:01:10 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-07-16 15:01:27 -0400
commit1396113ccbb6be895b1deb7c7eec228323e47078 (patch)
treef23b5041b7ebc706eb6073be39a54b089fe0125a /Remote/Helper
parentb698829a4bed783899b1f1156c49ac2c8b9aa8c8 (diff)
Fix bug that prevented uploads to remotes using new-style chunking from resuming after the last successfully uploaded chunk.
"checkPresent baser" was wrong; the baser has a dummy checkPresent action not the real one. So, to fix this, we need to call preparecheckpresent to get a checkpresent action that can be used to check if chunks are present. Note that, for remotes like S3, this means that the preparer is run, which opens a S3 handle, that will be used for each checkpresent of a chunk. That's a good thing; if we're resuming an upload that's already many chunks in, it'll reuse that same http connection for each chunk it checks. Still, it's not a perfectly ideal thing, since this is a different http connection that the one that will be used to upload chunks. It would be nice to improve the API so that both use the same http connection.
Diffstat (limited to 'Remote/Helper')
-rw-r--r--Remote/Helper/Special.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/Remote/Helper/Special.hs b/Remote/Helper/Special.hs
index 483ef576e..956d48273 100644
--- a/Remote/Helper/Special.hs
+++ b/Remote/Helper/Special.hs
@@ -184,12 +184,14 @@ specialRemote' cfg c preparestorer prepareretriever prepareremover preparecheckp
-- chunk, then encrypt, then feed to the storer
storeKeyGen k f p enc = safely $ preparestorer k $ safely . go
where
- go (Just storer) = sendAnnex k rollback $ \src ->
+ go (Just storer) = preparecheckpresent k $ safely . go' storer
+ go Nothing = return False
+ go' storer (Just checker) = sendAnnex k rollback $ \src ->
displayprogress p k f $ \p' ->
storeChunks (uuid baser) chunkconfig k src p'
(storechunk enc storer)
- (checkPresent baser)
- go Nothing = return False
+ checker
+ go' _ Nothing = return False
rollback = void $ removeKey encr k
storechunk Nothing storer k content p = storer k content p