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
|
type MutableVPNState = MVar VPNState
|
||||||
|
|
||||||
initState :: SysClient -> IO MutableVPNState
|
initState :: MonadUnliftIO m => SysClient -> m MutableVPNState
|
||||||
initState client = do
|
initState client = do
|
||||||
ot <- getVPNObjectTree client
|
ot <- getVPNObjectTree client
|
||||||
newMVar $ findTunnels ot
|
newMVar $ findTunnels ot
|
||||||
|
|
||||||
readState :: MutableVPNState -> IO Bool
|
readState :: MonadUnliftIO m => MutableVPNState -> m Bool
|
||||||
readState = fmap (not . null) . readMVar
|
readState = fmap (not . null) . readMVar
|
||||||
|
|
||||||
updateState
|
updateState
|
||||||
|
@ -72,7 +72,7 @@ updateState f state op = modifyMVar_ state $ return . f op
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- Tunnel Device Detection
|
-- Tunnel Device Detection
|
||||||
|
|
||||||
getVPNObjectTree :: SysClient -> IO ObjectTree
|
getVPNObjectTree :: MonadUnliftIO m => SysClient -> m ObjectTree
|
||||||
getVPNObjectTree sys = callGetManagedObjects sys vpnBus vpnPath
|
getVPNObjectTree sys = callGetManagedObjects sys vpnBus vpnPath
|
||||||
|
|
||||||
findTunnels :: ObjectTree -> VPNState
|
findTunnels :: ObjectTree -> VPNState
|
||||||
|
|
Loading…
Reference in New Issue