summaryrefslogtreecommitdiff
path: root/Assistant/Threads
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-11-05 16:00:55 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-11-05 16:00:55 -0400
commitdedc9790ef60b0965c0c34acd080ef8d4906e07a (patch)
treef1bb482373c0de02a0c886e2ab35482d3a818ae1 /Assistant/Threads
parent94e4fab7be5ecdc7889f592ed9d12a409a864738 (diff)
tweak
Diffstat (limited to 'Assistant/Threads')
-rw-r--r--Assistant/Threads/XMPPClient.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/Assistant/Threads/XMPPClient.hs b/Assistant/Threads/XMPPClient.hs
index 0836fa0f6..1b3f2bdef 100644
--- a/Assistant/Threads/XMPPClient.hs
+++ b/Assistant/Threads/XMPPClient.hs
@@ -50,24 +50,24 @@ xmppClientThread urlrenderer = NamedThread "XMPPClient" $ do
v <- liftAnnex getXMPPCreds
case v of
Nothing -> noop
- Just c -> liftIO $ loop c =<< getCurrentTime
+ Just c -> liftIO $ retry (runclient c) =<< getCurrentTime
where
debug' = void . liftIO . iodebug
{- When the client exits, it's restarted;
- if it keeps failing, back off to wait 5 minutes before
- trying it again. -}
- loop c starttime = do
- e <- runclient c
+ retry a starttime = do
+ e <- a
now <- getCurrentTime
if diffUTCTime now starttime > 300
then do
void $ iodebug ["connection lost; reconnecting", show e]
- loop c now
+ retry a now
else do
void $ iodebug ["connection failed; will retry", show e]
threadDelaySeconds (Seconds 300)
- loop c =<< getCurrentTime
+ retry a =<< getCurrentTime
runclient c = void $ connectXMPP c $ \jid -> do
selfjid <- bindJID jid