aboutsummaryrefslogtreecommitdiff
path: root/Remote/External
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-12-27 02:49:10 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-12-27 02:49:10 -0400
commit8ad91f287cf87b3a5a849d997de35210a0e9f2b7 (patch)
tree0850980711d834864512c2ef04ea0adf7bed0703 /Remote/External
parentd0d51528d0d90c218173593db17de1a480e0b15e (diff)
don't send PREPARE before INITREMOTE
That complicated special remote programs, because they had to avoid making PREPARE fail if some configuration is missing, because the remote might not be initialized yet. Instead, complicate git-annex slightly by only sending PREPARE immediately before some other request other than INITREMOTE (or PREPARE of course).
Diffstat (limited to 'Remote/External')
-rw-r--r--Remote/External/Types.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/Remote/External/Types.hs b/Remote/External/Types.hs
index 873c5c438..4000f3f49 100644
--- a/Remote/External/Types.hs
+++ b/Remote/External/Types.hs
@@ -18,6 +18,7 @@ module Remote.External.Types (
Sendable(..),
Receivable(..),
Request(..),
+ needsPREPARE,
Response(..),
RemoteRequest(..),
RemoteResponse(..),
@@ -60,6 +61,7 @@ data ExternalState = ExternalState
{ externalSend :: Handle
, externalReceive :: Handle
, externalPid :: ProcessHandle
+ , externalPrepared :: Bool
}
-- Constructor is not exported, and only created by newExternal.
@@ -98,6 +100,12 @@ data Request
| REMOVE Key
deriving (Show)
+-- Does PREPARE need to have been sent before this request?
+needsPREPARE :: Request -> Bool
+needsPREPARE PREPARE = False
+needsPREPARE INITREMOTE = False
+needsPREPARE _ = True
+
instance Sendable Request where
formatMessage PREPARE = ["PREPARE"]
formatMessage INITREMOTE = ["INITREMOTE"]