Browse Source

Remove the Unix domain socket file on exit

master
Peter J. Jones 3 years ago
parent
commit
4e968368c5
Signed by: Peter Jones <pjones@devalot.com> GPG Key ID: 9DAFAA8D01941E49
1 changed files with 7 additions and 1 deletions
  1. 7
    1
      src/lib/Network/XXX/ZigBee/Commander/Internal/Network.hs

+ 7
- 1
src/lib/Network/XXX/ZigBee/Commander/Internal/Network.hs View File

@@ -112,10 +112,16 @@ server = do
liftIO $ do
path <- serverSocketName
socket <- Network.listenOn (Network.UnixSocket path)
handler socket `finally` Network.sClose socket
handler socket `finally` cleanup socket path

where

----------------------------------------------------------------------------
cleanup :: Network.Socket -> FilePath -> IO ()
cleanup socket path = do
Network.sClose socket
removeFile path

----------------------------------------------------------------------------
listen :: (MonadIO m) => Network.Socket -> Commander m ()
listen socket = do

Loading…
Cancel
Save