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.
This commit is contained in:
Joey Hess 2013-03-06 16:29:19 -04:00
parent c23ea9e311
commit cbb6e1fae4
7 changed files with 76 additions and 49 deletions

View file

@ -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 $