From 0a87d90900949e6f7e75ab2ac83b4135746d7602 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 26 Oct 2012 00:02:03 -0400 Subject: improved dbus error handling Now when the dbus connection is dropped, it'll fall back to polling. I could make it try to reconnect, but there's a FD leak in the dbus library, so not yet. --- Assistant/Threads/MountWatcher.hs | 4 ++-- Assistant/Threads/NetWatcher.hs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'Assistant/Threads') diff --git a/Assistant/Threads/MountWatcher.hs b/Assistant/Threads/MountWatcher.hs index 462f5843c..294f9a972 100644 --- a/Assistant/Threads/MountWatcher.hs +++ b/Assistant/Threads/MountWatcher.hs @@ -51,7 +51,7 @@ mountWatcherThread st handle scanremotes = thread $ #if WITH_DBUS dbusThread :: ThreadState -> DaemonStatusHandle -> ScanRemoteMap -> IO () -dbusThread st dstatus scanremotes = E.catch (go =<< connectSession) onerr +dbusThread st dstatus scanremotes = E.catch (runClient getSessionAddress go) onerr where go client = ifM (checkMountMonitor client) ( do @@ -73,7 +73,7 @@ dbusThread st dstatus scanremotes = E.catch (go =<< connectSession) onerr onerr :: E.SomeException -> IO () onerr e = do runThreadState st $ - warning $ "Failed to use dbus; falling back to mtab polling (" ++ show e ++ ")" + warning $ "dbus failed; falling back to mtab polling (" ++ show e ++ ")" pollinstead pollinstead = pollingThread st dstatus scanremotes diff --git a/Assistant/Threads/NetWatcher.hs b/Assistant/Threads/NetWatcher.hs index a8daa9435..f9ca5641d 100644 --- a/Assistant/Threads/NetWatcher.hs +++ b/Assistant/Threads/NetWatcher.hs @@ -57,7 +57,7 @@ netWatcherFallbackThread st dstatus scanremotes = thread $ #if WITH_DBUS dbusThread :: ThreadState -> DaemonStatusHandle -> ScanRemoteMap -> IO () -dbusThread st dstatus scanremotes = E.catch (go =<< connectSystem) onerr +dbusThread st dstatus scanremotes = E.catch (runClient getSystemAddress go) onerr where go client = ifM (checkNetMonitor client) ( do @@ -69,7 +69,7 @@ dbusThread st dstatus scanremotes = E.catch (go =<< connectSystem) onerr ) onerr :: E.SomeException -> IO () onerr e = runThreadState st $ - warning $ "Failed to use dbus; falling back to polling (" ++ show e ++ ")" + warning $ "dbus failed; falling back to polling (" ++ show e ++ ")" handle = do debug thisThread ["detected network connection"] handleConnection st dstatus scanremotes -- cgit v1.2.3