From 49b88039e597ec761227d00ddf125f8ebe5c6a4f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 6 Mar 2013 15:09:31 -0400 Subject: assistant: Get back in sync with XMPP remotes after network reconnection, and on startup. Make manualPull send push requests over XMPP. When reconnecting with remotes, those that are XMPP remotes cannot immediately be pulled from and scanned, so instead maintain a set of (probably) desynced remotes, and put XMPP remotes on it. (This set could be used in other ways later, if we can detect we're out of sync with other types of remotes.) The merger handles detecting when a XMPP push is received from a desynced remote, and triggers a scan then, if they have in fact diverged. This has one known bug: A single XMPP remote can have multiple clients behind it. When this happens, only the UUID of one client is recorded as the UUID of the XMPP remote. Pushes from the other XMPP clients will not trigger a scan. If the client whose UUID is expected responds to the push request, it'll work, but when that client is offline, we're SOL. --- Assistant/XMPP/Git.hs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'Assistant/XMPP') diff --git a/Assistant/XMPP/Git.hs b/Assistant/XMPP/Git.hs index 8dba309a8..b5c8e382c 100644 --- a/Assistant/XMPP/Git.hs +++ b/Assistant/XMPP/Git.hs @@ -19,6 +19,7 @@ import Assistant.Sync import qualified Command.Sync import qualified Annex.Branch import Annex.UUID +import Annex.TaggedPush import Config import Git import qualified Git.Branch @@ -251,7 +252,6 @@ handlePushInitiation :: NetMessage -> Assistant () handlePushInitiation (Pushing cid CanPush) = whenXMPPRemote cid $ sendNetMessage $ Pushing cid PushRequest - handlePushInitiation (Pushing cid PushRequest) = go =<< liftAnnex (inRepo Git.Branch.current) where @@ -264,8 +264,7 @@ handlePushInitiation (Pushing cid PushRequest) = <*> getUUID liftIO $ Command.Sync.updateBranch (Command.Sync.syncBranch branch) g debug ["pushing to", show rs] - forM_ rs $ \r -> xmppPush cid $ pushFallback u branch r - + forM_ rs $ \r -> xmppPush cid $ taggedPush u branch r handlePushInitiation (Pushing cid StartingPush) = whenXMPPRemote cid $ void $ xmppReceivePack cid -- cgit v1.2.3