aboutsummaryrefslogtreecommitdiff
path: root/Assistant/XMPP/Git.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-11-09 16:04:55 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-11-09 16:04:55 -0400
commit5c928715e72b94c4fae601aebbe23fe5cd2436e3 (patch)
tree1d93ceb12be3ca12dcc7e169981f6bb8fd700650 /Assistant/XMPP/Git.hs
parentbea266e2c14163cac86a19b3f6b5ba834d9a0793 (diff)
run xmpp push actions in separate thread from xmpp client
Took me a while to figure out why the xmpp client was not receiving git xmpp push messages after a push started.
Diffstat (limited to 'Assistant/XMPP/Git.hs')
-rw-r--r--Assistant/XMPP/Git.hs20
1 files changed, 8 insertions, 12 deletions
diff --git a/Assistant/XMPP/Git.hs b/Assistant/XMPP/Git.hs
index 11b5dd907..a224adb3d 100644
--- a/Assistant/XMPP/Git.hs
+++ b/Assistant/XMPP/Git.hs
@@ -224,24 +224,20 @@ xmppRemotes cid = case baseJID <$> parseJID cid of
return $ repoIsUrl r && repoLocation r == "xmpp::" ++ want
handleDeferred :: NetMessage -> Assistant ()
-handleDeferred = void . handlePushMessage
+handleDeferred = handlePushMessage
-handlePushMessage :: NetMessage -> Assistant Bool
+handlePushMessage :: NetMessage -> Assistant ()
handlePushMessage (CanPush cid) = do
rs <- xmppRemotes cid
- if null rs
- then return False
- else do
- sendNetMessage $ PushRequest cid
- return True
+ unless (null rs) $
+ sendNetMessage $ PushRequest cid
handlePushMessage (PushRequest cid) = do
rs <- xmppRemotes cid
current <- liftAnnex $ inRepo Git.Branch.current
let refs = catMaybes [current, Just Annex.Branch.fullname]
- any id <$> (forM rs $ \r -> xmppPush cid r refs)
+ forM_ rs $ \r -> xmppPush cid r refs
handlePushMessage (StartingPush cid) = do
rs <- xmppRemotes cid
- if null rs
- then return False
- else xmppReceivePack cid
-handlePushMessage _ = return False
+ unless (null rs) $
+ void $ xmppReceivePack cid
+handlePushMessage _ = noop