aboutsummaryrefslogtreecommitdiff
path: root/Assistant/Sync.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-04-30 13:22:55 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-04-30 13:22:55 -0400
commitd12b1fb179bc1744f813ea3f616d503d2b0dfe09 (patch)
treedd4087ad7f6bf5883877c1c37e6a11c89cc5f46a /Assistant/Sync.hs
parenteba8c5d2610dd916401312e590fab2dcb713548c (diff)
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.
Diffstat (limited to 'Assistant/Sync.hs')
-rw-r--r--Assistant/Sync.hs5
1 files changed, 3 insertions, 2 deletions
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. -}