make tor hidden service work when directory watching is not available

Avoid crashing when built w/o inotify..
This commit is contained in:
Joey Hess 2016-12-09 16:27:20 -04:00
parent 8ac4126bd2
commit 9dd510bf29
No known key found for this signature in database
GPG key ID: C910D9222512E3C7
4 changed files with 22 additions and 18 deletions

View file

@ -71,7 +71,7 @@ stopWatchingChangedRefs h@(ChangedRefsHandle wh chan) = do
atomically $ closeTBMChan chan
drainChangedRefs h
watchChangedRefs :: Annex ChangedRefsHandle
watchChangedRefs :: Annex (Maybe ChangedRefsHandle)
watchChangedRefs = do
-- This channel is used to accumulate notifications,
-- because the DirWatcher might have multiple threads that find
@ -90,8 +90,11 @@ watchChangedRefs = do
, modifyHook = notifyhook
}
h <- liftIO $ watchDir refdir (const False) True hooks id
return $ ChangedRefsHandle h chan
if canWatch
then do
h <- liftIO $ watchDir refdir (const False) True hooks id
return $ Just $ ChangedRefsHandle h chan
else return Nothing
notifyHook :: TBMChan Git.Sha -> FilePath -> Maybe FileStatus -> IO ()
notifyHook chan reffile _