ENH generalize vpn plugin

This commit is contained in:
Nathan Dwarshuis 2022-12-30 17:02:23 -05:00
parent f39762e1e8
commit c36a63e251
1 changed files with 3 additions and 3 deletions

View File

@ -53,12 +53,12 @@ type VPNState = S.Set ObjectPath
type MutableVPNState = MVar VPNState
initState :: SysClient -> IO MutableVPNState
initState :: MonadUnliftIO m => SysClient -> m MutableVPNState
initState client = do
ot <- getVPNObjectTree client
newMVar $ findTunnels ot
readState :: MutableVPNState -> IO Bool
readState :: MonadUnliftIO m => MutableVPNState -> m Bool
readState = fmap (not . null) . readMVar
updateState
@ -72,7 +72,7 @@ updateState f state op = modifyMVar_ state $ return . f op
--------------------------------------------------------------------------------
-- Tunnel Device Detection
getVPNObjectTree :: SysClient -> IO ObjectTree
getVPNObjectTree :: MonadUnliftIO m => SysClient -> m ObjectTree
getVPNObjectTree sys = callGetManagedObjects sys vpnBus vpnPath
findTunnels :: ObjectTree -> VPNState