From cc49a73954ca4785ffed146dba67f8c984a12d65 Mon Sep 17 00:00:00 2001 From: Keagan McClelland Date: Fri, 26 Feb 2021 19:00:47 -0700 Subject: [PATCH] fix avahi-daemon edge case --- agent/src/Daemon/ZeroConf.hs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/agent/src/Daemon/ZeroConf.hs b/agent/src/Daemon/ZeroConf.hs index b9a34cd7f..0d44f2c6c 100644 --- a/agent/src/Daemon/ZeroConf.hs +++ b/agent/src/Daemon/ZeroConf.hs @@ -18,6 +18,9 @@ import Lib.ProductKey import Lib.SystemPaths import Settings +import qualified Lib.Algebra.Domain.AppMgr as AppMgr2 +import Control.Carrier.Lift +import Lib.Error start9AgentServicePrefix :: IsString a => a start9AgentServicePrefix = "start9-" @@ -53,4 +56,10 @@ publishAgentToAvahi = do "_http._tcp" agentPort lift Avahi.reload + lift $ threadDelay 10_000_000 + tid <- asks appLanThread >>= liftIO . takeMVar + liftIO $ killThread tid + tid' <- liftIO $ forkIO (runM . void . runExceptT @S9Error $ AppMgr2.runAppMgrCliC AppMgr2.lanEnable) + asks appLanThread >>= liftIO . flip putMVar tid' +