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).
This commit is contained in:
parent
5b7c38c90a
commit
3289155e28
3 changed files with 31 additions and 14 deletions
8
Remote/External/Types.hs
vendored
8
Remote/External/Types.hs
vendored
|
@ -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"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue