move externalConfig into ExternalState

Groundwork to having multiple processes running at once for an external
special remote; each needs its own externalConfig.
This commit is contained in:
Joey Hess 2016-09-30 13:36:50 -04:00
parent 63e21a607f
commit b69dea0ac3
No known key found for this signature in database
GPG key ID: C910D9222512E3C7
2 changed files with 29 additions and 20 deletions

View file

@ -52,8 +52,7 @@ data External = External
, externalState :: TMVar ExternalState
-- Empty when a remote is in use.
, externalLock :: TMVar ExternalLock
-- Never left empty.
, externalConfig :: TMVar RemoteConfig
, externalDefaultConfig :: RemoteConfig
, externalGitConfig :: RemoteGitConfig
}
@ -63,7 +62,7 @@ newExternal externaltype u c gc = liftIO $ External
<*> pure u
<*> atomically newEmptyTMVar
<*> atomically (newTMVar ExternalLock)
<*> atomically (newTMVar c)
<*> pure c
<*> pure gc
type ExternalType = String
@ -73,6 +72,8 @@ data ExternalState = ExternalState
, externalReceive :: Handle
, externalShutdown :: IO ()
, externalPrepared :: PrepareStatus
-- Never left empty.
, externalConfig :: TMVar RemoteConfig
}
data PrepareStatus = Unprepared | Prepared | FailedPrepare ErrorMsg