summaryrefslogtreecommitdiff
path: root/RemoteDaemon
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-04-20 15:45:14 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-04-20 15:45:14 -0400
commit777747f082c07106beadead4f15aac85a48c9dd0 (patch)
treee4abe430f3b6fe77fedde527373cfdddc4c938a9 /RemoteDaemon
parent619919bd49c342de60a63f16c835f0dd4acb9acb (diff)
fix RELOAD
Diffstat (limited to 'RemoteDaemon')
-rw-r--r--RemoteDaemon/Core.hs15
-rw-r--r--RemoteDaemon/Types.hs4
2 files changed, 15 insertions, 4 deletions
diff --git a/RemoteDaemon/Core.hs b/RemoteDaemon/Core.hs
index 0be9c93f0..60a4d5ceb 100644
--- a/RemoteDaemon/Core.hs
+++ b/RemoteDaemon/Core.hs
@@ -61,15 +61,15 @@ runController ichan ochan = do
cmd <- readChan ichan
case cmd of
RELOAD -> do
- liftAnnex h reloadConfig
- m' <- genRemoteMap h ochan
+ h' <- updateTransportHandle h
+ m' <- genRemoteMap h' ochan
let common = M.intersection m m'
let new = M.difference m' m
let old = M.difference m m'
broadcast STOP old
unless paused $
startrunning new
- go h paused (M.union common new)
+ go h' paused (M.union common new)
LOSTNET -> do
-- force close all cached ssh connections
-- (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,
-- except those that have annex.sync = false
genRemoteMap :: TransportHandle -> Chan Emitted -> IO RemoteMap
-genRemoteMap h@(TransportHandle g _) ochan =
+genRemoteMap h@(TransportHandle g _) ochan =
M.fromList . catMaybes <$> mapM gen (Git.remotes g)
where
gen r = case Git.location r of
@@ -124,3 +124,10 @@ genTransportHandle = do
annexstate <- newMVar =<< Annex.new =<< Git.CurrentRepo.get
g <- Annex.repo <$> readMVar 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)
diff --git a/RemoteDaemon/Types.hs b/RemoteDaemon/Types.hs
index 0e44874d2..0a7269534 100644
--- a/RemoteDaemon/Types.hs
+++ b/RemoteDaemon/Types.hs
@@ -30,6 +30,10 @@ type RemoteRepo = Git.Repo
type LocalRepo = Git.Repo
-- 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)
-- Messages that the daemon emits.