summaryrefslogtreecommitdiff
path: root/Assistant/Types
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-03-06 15:09:31 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-03-06 15:09:31 -0400
commit49b88039e597ec761227d00ddf125f8ebe5c6a4f (patch)
tree660cbf757c53229b12629f0da29a0d405a95bed2 /Assistant/Types
parent32743077f40eeb21eb3fc230c1d2a46b1b1181e4 (diff)
assistant: Get back in sync with XMPP remotes after network reconnection, and on startup.
Make manualPull send push requests over XMPP. When reconnecting with remotes, those that are XMPP remotes cannot immediately be pulled from and scanned, so instead maintain a set of (probably) desynced remotes, and put XMPP remotes on it. (This set could be used in other ways later, if we can detect we're out of sync with other types of remotes.) The merger handles detecting when a XMPP push is received from a desynced remote, and triggers a scan then, if they have in fact diverged. This has one known bug: A single XMPP remote can have multiple clients behind it. When this happens, only the UUID of one client is recorded as the UUID of the XMPP remote. Pushes from the other XMPP clients will not trigger a scan. If the client whose UUID is expected responds to the push request, it'll work, but when that client is offline, we're SOL.
Diffstat (limited to 'Assistant/Types')
-rw-r--r--Assistant/Types/DaemonStatus.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/Assistant/Types/DaemonStatus.hs b/Assistant/Types/DaemonStatus.hs
index b60d49edf..7da85daa0 100644
--- a/Assistant/Types/DaemonStatus.hs
+++ b/Assistant/Types/DaemonStatus.hs
@@ -20,6 +20,7 @@ import Control.Concurrent.STM
import Control.Concurrent.Async
import Data.Time.Clock.POSIX
import qualified Data.Map as M
+import qualified Data.Set as S
data DaemonStatus = DaemonStatus
-- All the named threads that comprise the daemon,
@@ -44,6 +45,8 @@ data DaemonStatus = DaemonStatus
, syncGitRemotes :: [Remote]
-- Ordered list of remotes to sync data with
, syncDataRemotes :: [Remote]
+ -- List of uuids of remotes that we may have gotten out of sync with.
+ , desynced :: S.Set UUID
-- Pairing request that is in progress.
, pairingInProgress :: Maybe PairingInProgress
-- Broadcasts notifications about all changes to the DaemonStatus
@@ -74,6 +77,7 @@ newDaemonStatus = DaemonStatus
<*> pure []
<*> pure []
<*> pure []
+ <*> pure S.empty
<*> pure Nothing
<*> newNotificationBroadcaster
<*> newNotificationBroadcaster