From d11aad0d99b1e24cf5ba08800c8333f8a379db8b Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 17 Nov 2016 20:54:14 -0400 Subject: avoid setPresent when sending to a peer This mirrors how git-annex-shell works; recvKey updates location tracking, but sendKey does not. --- Remote/Helper/P2P.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'Remote') 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 -- cgit v1.2.3