From 5a68acb521bae0277b2c8a8ca023dc57a5ff4b33 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 21 Aug 2012 19:58:53 -0400 Subject: add NetWatcher thread This deals with interruptions in network connectevity, by listening for a new network interface coming up (using dbus to see when network-manager or wicd do it), and forcing a rescan of --- Assistant/Threads/MountWatcher.hs | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'Assistant/Threads/MountWatcher.hs') diff --git a/Assistant/Threads/MountWatcher.hs b/Assistant/Threads/MountWatcher.hs index 83f582a91..82de186cc 100644 --- a/Assistant/Threads/MountWatcher.hs +++ b/Assistant/Threads/MountWatcher.hs @@ -31,6 +31,7 @@ import qualified Data.Set as S import Data.Time.Clock #if WITH_DBUS +import Utility.DBus import DBus.Client import DBus import Data.Word (Word32) @@ -78,20 +79,6 @@ dbusThread st dstatus scanremotes = E.catch (go =<< connectSession) onerr pollinstead pollinstead = pollingThread st dstatus scanremotes -type ServiceName = String - -listServiceNames :: Client -> IO [ServiceName] -listServiceNames client = do - reply <- callDBus client "ListNames" [] - return $ fromMaybe [] $ fromVariant (methodReturnBody reply !! 0) - -callDBus :: Client -> MemberName -> [Variant] -> IO MethodReturn -callDBus client name params = call_ client $ - (methodCall "/org/freedesktop/DBus" "org.freedesktop.DBus" name) - { methodCallDestination = Just "org.freedesktop.DBus" - , methodCallBody = params - } - {- Examine the list of services connected to dbus, to see if there - are any we can use to monitor mounts. If not, will attempt to start one. -} checkMountMonitor :: Client -> IO Bool @@ -164,7 +151,7 @@ handleMount st dstatus scanremotes dir = do let nonspecial = filter (Git.repoIsLocal . Remote.repo) rs unless (null nonspecial) $ do void $ alertWhile dstatus (syncAlert nonspecial) $ do - debug thisThread ["syncing with", show rs] + debug thisThread ["syncing with", show nonspecial] sync nonspecial =<< runThreadState st (inRepo Git.Branch.current) addScanRemotes scanremotes nonspecial where -- cgit v1.2.3