Skip to content

Commit

Permalink
Clean the snocket module
Browse files Browse the repository at this point in the history
  • Loading branch information
coot authored and newhoggy committed Nov 23, 2020
1 parent 724cc1e commit 69decd9
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions ouroboros-network-framework/src/Ouroboros/Network/Snocket.hs
Expand Up @@ -270,7 +270,7 @@ socketSnocket ioManager = Snocket {


--
-- NamedPipes based Snocket
-- LocalSnockets either based on unix sockets or named pipes.
--

#if defined(mingw32_HOST_OS)
Expand All @@ -285,16 +285,9 @@ newtype LocalSocket = LocalSocket { getLocalHandle :: LocalHandle }
-- | System dependent LocalSnocket
type LocalSnocket = Snocket IO LocalSocket LocalAddress



localSnocket :: IOManager -> FilePath -> LocalSnocket
#if defined(mingw32_HOST_OS)
-- | Create a Windows Named Pipe Snocket.
--
namedPipeSnocket
:: IOManager
-> FilePath
-> LocalSnocket
namedPipeSnocket ioManager path = Snocket {
localSnocket ioManager path = Snocket {
getLocalAddr = \_ -> return localAddress
, getRemoteAddr = \_ -> return localAddress
, addrFamily = \_ -> LocalFamily
Expand Down Expand Up @@ -367,13 +360,10 @@ namedPipeSnocket ioManager path = Snocket {
associateWithIOManager ioManager (Left hpipe)
Win32.Async.connectNamedPipe hpipe
return (LocalSocket hpipe, localAddress, acceptNext)
#endif


localSnocket :: IOManager -> FilePath -> LocalSnocket
#if defined(mingw32_HOST_OS)
localSnocket = namedPipeSnocket
-- local snocket on unix
#else

localSnocket ioManager _ =
Snocket {
getLocalAddr = fmap toLocalAddress . Socket.getSocketName . getLocalHandle
Expand Down

0 comments on commit 69decd9

Please sign in to comment.