From 0e38adb65a1cbcf77a0ba641989dfe4e9482cd8a Mon Sep 17 00:00:00 2001 From: Marcin Szamotulski Date: Wed, 25 Mar 2020 07:56:52 +0100 Subject: [PATCH] Fixed windows build of network-mux --- network-mux/demo/mux-demo.hs | 9 +++++---- network-mux/test/Test/Mux.hs | 7 ++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/network-mux/demo/mux-demo.hs b/network-mux/demo/mux-demo.hs index c1d0318b92f..0addff2274b 100644 --- a/network-mux/demo/mux-demo.hs +++ b/network-mux/demo/mux-demo.hs @@ -25,6 +25,7 @@ import Test.Mux.ReqResp import System.Win32 import System.Win32.NamedPipes import qualified System.Win32.Async as Win32.Async +import System.IOManager import System.IO import System.Exit @@ -71,7 +72,7 @@ defaultProtocolLimits = -- | Server accept loop. -- echoServer :: IO () -echoServer = Win32.Async.withIOManager $ \iocp -> do +echoServer = withIOManager $ \ioManager -> do hpipe <- createNamedPipe pipeName (pIPE_ACCESS_DUPLEX .|. fILE_FLAG_OVERLAPPED) (pIPE_TYPE_BYTE .|. pIPE_READMODE_BYTE) @@ -80,7 +81,7 @@ echoServer = Win32.Async.withIOManager $ \iocp -> do 1024 0 Nothing - Win32.Async.associateWithIOCompletionPort (Left hpipe) iocp + associateWithIOManager ioManager (Left hpipe) Win32.Async.connectNamedPipe hpipe _ <- forkIO $ do serverLoop hpipe @@ -122,7 +123,7 @@ serverLoop h = do client :: Int -> String -> IO () -client n msg = Win32.Async.withIOManager $ \iocp -> do +client n msg = withIOManager $ \ioManager -> do hpipe <- createFile pipeName (gENERIC_READ .|. gENERIC_WRITE) fILE_SHARE_NONE @@ -130,7 +131,7 @@ client n msg = Win32.Async.withIOManager $ \iocp -> do oPEN_EXISTING fILE_FLAG_OVERLAPPED Nothing - Win32.Async.associateWithIOCompletionPort (Left hpipe) iocp + associateWithIOManager ioManager (Left hpipe) let pipeChannel = Mx.pipeChannelFromNamedPipe hpipe bearer = Mx.pipeAsMuxBearer nullTracer pipeChannel Mx.muxStart diff --git a/network-mux/test/Test/Mux.hs b/network-mux/test/Test/Mux.hs index cc5d7fbcc41..f4514616385 100644 --- a/network-mux/test/Test/Mux.hs +++ b/network-mux/test/Test/Mux.hs @@ -50,6 +50,7 @@ import Control.Tracer (Tracer (..), contramap, nullTracer) import qualified System.Win32.NamedPipes as Win32.NamedPipes import qualified System.Win32.File as Win32.File import qualified System.Win32.Async as Win32.Async +import System.IOManager #else import System.IO (hClose) import System.Process (createPipe) @@ -460,7 +461,7 @@ runWithQueues initApp respApp = do runWithPipe :: RunMuxApplications runWithPipe initApp respApp = #if defined(mingw32_HOST_OS) - Win32.Async.withIOManager $ \iocp -> do + withIOManager $ \ioManager -> do let pipeName = "\\\\.\\pipe\\mux-test-pipe" bracket (Win32.NamedPipes.createNamedPipe @@ -484,8 +485,8 @@ runWithPipe initApp respApp = Nothing) Win32.File.closeHandle $ \hCli -> do - Win32.Async.associateWithIOCompletionPort (Left hSrv) iocp - Win32.Async.associateWithIOCompletionPort (Left hCli) iocp + associateWithIOManager ioManager (Left hSrv) + associateWithIOManager ioManager (Left hCli) let clientChannel = pipeChannelFromNamedPipe hCli serverChannel = pipeChannelFromNamedPipe hSrv