summaryrefslogtreecommitdiff
path: root/Remote/Helper
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-07-01 16:59:54 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-07-01 17:15:11 -0400
commit7225c2bfc0c7149e646fa9af998da983e3fa8bc8 (patch)
treea07f878efd0876f539e4c10a6572be001ef41189 /Remote/Helper
parent8c10f377146e6599054488f47a3a742f6a7c5ae2 (diff)
record transfer information on local git remotes
In order to record a semi-useful filename associated with the key, this required plumbing the filename all the way through to the remotes' storeKey and retrieveKeyFile. Note that there is potential for deadlock here, narrowly avoided. Suppose the repos are A and B. A sends file foo to B, and at the same time, B gets file foo from A. So, A locks its upload transfer info file, and then locks B's download transfer info file. At the same time, B is taking the two locks in the opposite order. This is only not a deadlock because the lock code does not wait, and aborts. So one of A or B's transfers will be aborted and the other transfer will continue. Whew!
Diffstat (limited to 'Remote/Helper')
-rw-r--r--Remote/Helper/Encryptable.hs14
-rw-r--r--Remote/Helper/Hooks.hs4
2 files changed, 9 insertions, 9 deletions
diff --git a/Remote/Helper/Encryptable.hs b/Remote/Helper/Encryptable.hs
index 789a1d996..6d5405d9e 100644
--- a/Remote/Helper/Encryptable.hs
+++ b/Remote/Helper/Encryptable.hs
@@ -59,14 +59,14 @@ encryptableRemote c storeKeyEncrypted retrieveKeyFileEncrypted r =
cost = cost r + encryptedRemoteCostAdj
}
where
- store k = cip k >>= maybe
- (storeKey r k)
+ store k f = cip k >>= maybe
+ (storeKey r k f)
(`storeKeyEncrypted` k)
- retrieve k f = cip k >>= maybe
- (retrieveKeyFile r k f)
- (\enck -> retrieveKeyFileEncrypted enck k f)
- retrieveCheap k f = cip k >>= maybe
- (retrieveKeyFileCheap r k f)
+ retrieve k f d = cip k >>= maybe
+ (retrieveKeyFile r k f d)
+ (\enck -> retrieveKeyFileEncrypted enck k d)
+ retrieveCheap k d = cip k >>= maybe
+ (retrieveKeyFileCheap r k d)
(\_ -> return False)
withkey a k = cip k >>= maybe (a k) (a . snd)
cip = cipherKey c
diff --git a/Remote/Helper/Hooks.hs b/Remote/Helper/Hooks.hs
index d85959062..0a6b22081 100644
--- a/Remote/Helper/Hooks.hs
+++ b/Remote/Helper/Hooks.hs
@@ -27,8 +27,8 @@ addHooks' r Nothing Nothing = r
addHooks' r starthook stophook = r'
where
r' = r
- { storeKey = \k -> wrapper $ storeKey r k
- , retrieveKeyFile = \k f -> wrapper $ retrieveKeyFile r k f
+ { storeKey = \k f -> wrapper $ storeKey r k f
+ , retrieveKeyFile = \k f d -> wrapper $ retrieveKeyFile r k f d
, retrieveKeyFileCheap = \k f -> wrapper $ retrieveKeyFileCheap r k f
, removeKey = \k -> wrapper $ removeKey r k
, hasKey = \k -> wrapper $ hasKey r k