|
|
|
@ -195,8 +195,11 @@ session realm mbSasl config = runErrorT $ do |
|
|
|
liftIO $ when (enableRoster config) $ initRoster ses |
|
|
|
liftIO $ when (enableRoster config) $ initRoster ses |
|
|
|
return ses |
|
|
|
return ses |
|
|
|
|
|
|
|
|
|
|
|
-- | Reconnect immediately with the stored settings. Returns Just the error when |
|
|
|
-- | Reconnect immediately with the stored settings. Returns @Just@ the error |
|
|
|
-- the reconnect attempt fails and Nothing when no failure was encountered |
|
|
|
-- when the reconnect attempt fails and Nothing when no failure was encountered. |
|
|
|
|
|
|
|
-- |
|
|
|
|
|
|
|
-- This function does not set your presence to online, so you will have to do |
|
|
|
|
|
|
|
-- this yourself. |
|
|
|
reconnectNow :: Session -- ^ session to reconnect |
|
|
|
reconnectNow :: Session -- ^ session to reconnect |
|
|
|
-> IO (Maybe XmppFailure) |
|
|
|
-> IO (Maybe XmppFailure) |
|
|
|
reconnectNow sess@Session{conf = config, reconnectWait = rw} = do |
|
|
|
reconnectNow sess@Session{conf = config, reconnectWait = rw} = do |
|
|
|
@ -234,17 +237,20 @@ reconnectNow sess@Session{conf = config, reconnectWait = rw} = do |
|
|
|
return Nothing |
|
|
|
return Nothing |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- | Reconnect with the stored settings. Returns a list of errors when the |
|
|
|
-- | Reconnect with the stored settings. |
|
|
|
-- reconnect attempt fail and Nothing when no failure was encountered |
|
|
|
|
|
|
|
-- |
|
|
|
-- |
|
|
|
-- Waits a random amount of seconds (between 0 and 60 inclusive) before the |
|
|
|
-- Waits a random amount of seconds (between 0 and 60 inclusive) before the |
|
|
|
-- first attempt and an increasing amount after each attempt after that. Caps |
|
|
|
-- first attempt and an increasing amount after each attempt after that. Caps |
|
|
|
-- out at 2-5 minutes. |
|
|
|
-- out at 2-5 minutes. |
|
|
|
reconnect :: Integer -- ^ maximum number of retries (Nothing for |
|
|
|
-- |
|
|
|
-- unbounded). Numbers of 1 or less will perform exactly |
|
|
|
-- This function does not set your presence to online, so you will have to do |
|
|
|
-- one retry |
|
|
|
-- this yourself. |
|
|
|
-> Session -- ^ session to reconnect |
|
|
|
reconnect :: Integer -- ^ Maximum number of retries (numbers of 1 or less will |
|
|
|
-> IO (Bool, [XmppFailure]) -- ^ The failure modes of the retries |
|
|
|
-- perform exactly one retry) |
|
|
|
|
|
|
|
-> Session -- ^ Session to reconnect |
|
|
|
|
|
|
|
-> IO (Bool, [XmppFailure]) -- ^ Whether or not the reconnect attempt |
|
|
|
|
|
|
|
-- was successful, and a list of failure |
|
|
|
|
|
|
|
-- modes encountered |
|
|
|
reconnect maxTries sess = go maxTries |
|
|
|
reconnect maxTries sess = go maxTries |
|
|
|
where |
|
|
|
where |
|
|
|
go t = do |
|
|
|
go t = do |
|
|
|
@ -260,8 +266,10 @@ reconnect maxTries sess = go maxTries |
|
|
|
-- first attempt and an increasing amount after each attempt after that. Caps |
|
|
|
-- first attempt and an increasing amount after each attempt after that. Caps |
|
|
|
-- out at 2-5 minutes. |
|
|
|
-- out at 2-5 minutes. |
|
|
|
-- |
|
|
|
-- |
|
|
|
reconnect' :: Session -- ^ session to reconnect |
|
|
|
-- This function does not set your presence to online, so you will have to do |
|
|
|
-> IO Integer -- ^ number of failed retries before connection could be |
|
|
|
-- this yourself. |
|
|
|
|
|
|
|
reconnect' :: Session -- ^ Session to reconnect |
|
|
|
|
|
|
|
-> IO Integer -- ^ Number of failed retries before connection could be |
|
|
|
-- established |
|
|
|
-- established |
|
|
|
reconnect' sess = go 0 |
|
|
|
reconnect' sess = go 0 |
|
|
|
where |
|
|
|
where |
|
|
|
|