From d12b1fb179bc1744f813ea3f616d503d2b0dfe09 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 30 Apr 2013 13:22:55 -0400 Subject: add uuid to all xmpp messages (Except for the actual streaming of receive-pack through XMPP, which can only run once we've gotten an appropriate uuid in a push initiation message.) Pushes are now only initiated when the initiation message comes from a known uuid. This allows multiple distinct repositories to use the same xmpp address. Note: This probably breaks initial push after xmpp pairing, because at that point we may not know about the paired uuid, and so reject the push from it. It won't break in simple cases, because the annex-uuid of the remote is checked. However, when there are multiple clients behind a single xmpp address, only uuid of the first is recorded in annex-uuid, and so any pushes from the others will be rejected (unless the first remote pushes their uuids to us beforehand. --- Assistant/Sync.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Assistant/Sync.hs') diff --git a/Assistant/Sync.hs b/Assistant/Sync.hs index 727749c4f..1b9de1656 100644 --- a/Assistant/Sync.hs +++ b/Assistant/Sync.hs @@ -113,7 +113,7 @@ pushToRemotes' now notifypushes remotes = do let (xmppremotes, normalremotes) = partition isXMPPRemote remotes ret <- go True branch g u normalremotes forM_ xmppremotes $ \r -> - sendNetMessage $ Pushing (getXMPPClientID r) CanPush + sendNetMessage $ Pushing (getXMPPClientID r) (CanPush u) return ret where go _ Nothing _ _ _ = return [] -- no branch, so nothing to do @@ -202,8 +202,9 @@ manualPull currentbranch remotes = do haddiverged <- liftAnnex Annex.Branch.forceUpdate forM_ normalremotes $ \r -> liftAnnex $ Command.Sync.mergeRemote r currentbranch + u <- liftAnnex getUUID forM_ xmppremotes $ \r -> - sendNetMessage $ Pushing (getXMPPClientID r) PushRequest + sendNetMessage $ Pushing (getXMPPClientID r) (PushRequest u) return (catMaybes failed, haddiverged) {- Start syncing a remote, using a background thread. -} -- cgit v1.2.3