aboutsummaryrefslogtreecommitdiff
path: root/Remote
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-11-17 20:54:14 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-11-17 20:54:14 -0400
commitd11aad0d99b1e24cf5ba08800c8333f8a379db8b (patch)
tree48aeb5ce99485ab6a3ac26832a9fff19c2e54bad /Remote
parent49da2d5efdad0038f22bc5e3bc50cf117849d472 (diff)
avoid setPresent when sending to a peer
This mirrors how git-annex-shell works; recvKey updates location tracking, but sendKey does not.
Diffstat (limited to 'Remote')
-rw-r--r--Remote/Helper/P2P.hs7
1 files changed, 3 insertions, 4 deletions
diff --git a/Remote/Helper/P2P.hs b/Remote/Helper/P2P.hs
index d973880f7..0b4d05847 100644
--- a/Remote/Helper/P2P.hs
+++ b/Remote/Helper/P2P.hs
@@ -160,10 +160,6 @@ serve myuuid = go Nothing
go autheduuid
authed theiruuid r = case r of
- GET offset key -> do
- ok <- sendContent key offset
- when ok $
- setPresent key theiruuid
PUT key -> do
(Len n) <- keyFileSize key
let offset = Offset n
@@ -174,6 +170,9 @@ serve myuuid = go Nothing
void $ receiveContent key offset len
setPresent key myuuid
_ -> sendMessage (PROTO_ERROR "expected DATA")
+ -- setPresent not called because the peer may have
+ -- requested the data but not permanatly stored it.
+ GET offset key -> sendContent key offset
_ -> sendMessage (PROTO_ERROR "unexpected command")
sendContent :: Key -> Offset -> Proto Bool