fix RELOAD
This commit is contained in:
parent
512da29273
commit
f3261ce525
2 changed files with 15 additions and 4 deletions
|
@ -61,15 +61,15 @@ runController ichan ochan = do
|
||||||
cmd <- readChan ichan
|
cmd <- readChan ichan
|
||||||
case cmd of
|
case cmd of
|
||||||
RELOAD -> do
|
RELOAD -> do
|
||||||
liftAnnex h reloadConfig
|
h' <- updateTransportHandle h
|
||||||
m' <- genRemoteMap h ochan
|
m' <- genRemoteMap h' ochan
|
||||||
let common = M.intersection m m'
|
let common = M.intersection m m'
|
||||||
let new = M.difference m' m
|
let new = M.difference m' m
|
||||||
let old = M.difference m m'
|
let old = M.difference m m'
|
||||||
broadcast STOP old
|
broadcast STOP old
|
||||||
unless paused $
|
unless paused $
|
||||||
startrunning new
|
startrunning new
|
||||||
go h paused (M.union common new)
|
go h' paused (M.union common new)
|
||||||
LOSTNET -> do
|
LOSTNET -> do
|
||||||
-- force close all cached ssh connections
|
-- force close all cached ssh connections
|
||||||
-- (done here so that if there are multiple
|
-- (done here so that if there are multiple
|
||||||
|
@ -104,7 +104,7 @@ runController ichan ochan = do
|
||||||
-- Generates a map with a transport for each supported remote in the git repo,
|
-- Generates a map with a transport for each supported remote in the git repo,
|
||||||
-- except those that have annex.sync = false
|
-- except those that have annex.sync = false
|
||||||
genRemoteMap :: TransportHandle -> Chan Emitted -> IO RemoteMap
|
genRemoteMap :: TransportHandle -> Chan Emitted -> IO RemoteMap
|
||||||
genRemoteMap h@(TransportHandle g _) ochan =
|
genRemoteMap h@(TransportHandle g _) ochan =
|
||||||
M.fromList . catMaybes <$> mapM gen (Git.remotes g)
|
M.fromList . catMaybes <$> mapM gen (Git.remotes g)
|
||||||
where
|
where
|
||||||
gen r = case Git.location r of
|
gen r = case Git.location r of
|
||||||
|
@ -124,3 +124,10 @@ genTransportHandle = do
|
||||||
annexstate <- newMVar =<< Annex.new =<< Git.CurrentRepo.get
|
annexstate <- newMVar =<< Annex.new =<< Git.CurrentRepo.get
|
||||||
g <- Annex.repo <$> readMVar annexstate
|
g <- Annex.repo <$> readMVar annexstate
|
||||||
return $ TransportHandle g annexstate
|
return $ TransportHandle g annexstate
|
||||||
|
|
||||||
|
updateTransportHandle :: TransportHandle -> IO TransportHandle
|
||||||
|
updateTransportHandle h@(TransportHandle _g annexstate) = do
|
||||||
|
g' <- liftAnnex h $ do
|
||||||
|
reloadConfig
|
||||||
|
Annex.fromRepo id
|
||||||
|
return (TransportHandle g' annexstate)
|
||||||
|
|
|
@ -30,6 +30,10 @@ type RemoteRepo = Git.Repo
|
||||||
type LocalRepo = Git.Repo
|
type LocalRepo = Git.Repo
|
||||||
|
|
||||||
-- All Transports share a single AnnexState MVar
|
-- All Transports share a single AnnexState MVar
|
||||||
|
--
|
||||||
|
-- Different TransportHandles may have different versions of the LocalRepo.
|
||||||
|
-- (For example, the ssh transport modifies it to enable ssh connection
|
||||||
|
-- caching.)
|
||||||
data TransportHandle = TransportHandle LocalRepo (MVar Annex.AnnexState)
|
data TransportHandle = TransportHandle LocalRepo (MVar Annex.AnnexState)
|
||||||
|
|
||||||
-- Messages that the daemon emits.
|
-- Messages that the daemon emits.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue