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.
This commit is contained in:
parent
43c9732940
commit
ef7b53e784
3 changed files with 61 additions and 4 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue