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

@ -24,18 +24,19 @@ seek :: CmdParams -> CommandSeek
seek = withNothing start
start :: CommandStart
start = do
h <- watchChangedRefs
start = go =<< watchChangedRefs
where
go (Just h) = do
-- No messages need to be received from the caller,
-- but when it closes the connection, notice and terminate.
let receiver = forever $ void $ getProtocolLine stdin
let sender = forever $ send . CHANGED =<< waitChangedRefs h
-- No messages need to be received from the caller,
-- but when it closes the connection, notice and terminate.
let receiver = forever $ void $ getProtocolLine stdin
let sender = forever $ send . CHANGED =<< waitChangedRefs h
liftIO $ send READY
void $ liftIO $ concurrently sender receiver
liftIO $ stopWatchingChangedRefs h
stop
liftIO $ send READY
void $ liftIO $ concurrently sender receiver
liftIO $ stopWatchingChangedRefs h
stop
go Nothing = stop
send :: Notification -> IO ()
send n = do