aboutsummaryrefslogtreecommitdiff
path: root/Assistant/Sync.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-03-06 16:29:19 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-03-06 16:29:19 -0400
commitdc82128f6f0ffef9f6973baed3ad63d89802c898 (patch)
tree93ff21057d04f9d1c48e4c9e2fa75de092dc1908 /Assistant/Sync.hs
parent49b88039e597ec761227d00ddf125f8ebe5c6a4f (diff)
tag xmpp pushes with jid
This fixes the issue mentioned in the last commit. Turns out just collecting UUID of clients behind a XMPP remote is insufficient (although I should probably still do it for other reasons), because a single remote repo might be connected via both XMPP and local pairing. So a way is needed to know when a push was received from any client using a given XMPP remote over XMPP, as opposed to via ssh.
Diffstat (limited to 'Assistant/Sync.hs')
-rw-r--r--Assistant/Sync.hs15
1 files changed, 9 insertions, 6 deletions
diff --git a/Assistant/Sync.hs b/Assistant/Sync.hs
index f8dcd6748..901694920 100644
--- a/Assistant/Sync.hs
+++ b/Assistant/Sync.hs
@@ -48,11 +48,9 @@ reconnectRemotes _ [] = noop
reconnectRemotes notifypushes rs = void $ do
modifyDaemonStatus_ $ \s -> s
{ desynced = S.union (S.fromList $ map Remote.uuid xmppremotes) (desynced s) }
- alertWhile (syncAlert normalremotes) $ do
- (ok, diverged) <- sync
- =<< liftAnnex (inRepo Git.Branch.current)
- addScanRemotes diverged rs
- return ok
+ if null normalremotes
+ then go
+ else alertWhile (syncAlert normalremotes) go
where
gitremotes = filter (notspecialremote . Remote.repo) rs
(xmppremotes, normalremotes) = partition isXMPPRemote gitremotes
@@ -69,6 +67,11 @@ reconnectRemotes notifypushes rs = void $ do
sync Nothing = do
diverged <- snd <$> manualPull Nothing gitremotes
return (True, diverged)
+ go = do
+ (ok, diverged) <- sync
+ =<< liftAnnex (inRepo Git.Branch.current)
+ addScanRemotes diverged rs
+ return ok
{- Updates the local sync branch, then pushes it to all remotes, in
- parallel, along with the git-annex branch. This is the same
@@ -137,7 +140,7 @@ pushToRemotes now notifypushes remotes = do
fallback branch g u rs = do
debug ["fallback pushing to", show rs]
(succeeded, failed) <- liftIO $
- inParallel (\r -> taggedPush u branch r g) rs
+ inParallel (\r -> taggedPush u Nothing branch r g) rs
updatemap succeeded failed
when (notifypushes && (not $ null succeeded)) $
sendNetMessage $ NotifyPush $