ENH generalize vpn plugin
This commit is contained in:
parent
f39762e1e8
commit
c36a63e251
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue