diff --git a/.gitignore b/.gitignore index 02b709e..7c2e901 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ docs/templates/out .cabal-sandbox/ cabal.sandbox.config cabal.project.local +.stack-work/ diff --git a/changelog.md b/changelog.md index ca05908..b218daf 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,6 @@ +# Version 1.5.0.2 +Fix [stackage#4312](https://github.com/commercialhaskell/stackage/issues/4312): Relax `network` upper bound + # Version 1.5.0.1 Bugfix: `concurrentMerge []` should not block forever, even if this case is pathological. diff --git a/io-streams.cabal b/io-streams.cabal index e43e2c0..73a17d4 100644 --- a/io-streams.cabal +++ b/io-streams.cabal @@ -1,5 +1,5 @@ Name: io-streams -Version: 1.5.0.1 +Version: 1.5.0.2 License: BSD3 License-file: LICENSE Category: Data, Network, IO-Streams @@ -124,7 +124,7 @@ Library attoparsec >= 0.10 && <0.14, bytestring >= 0.9 && <0.11, bytestring-builder >= 0.10 && <0.11, - network >= 2.3 && <2.9, + network >= 2.3 && <3.1, primitive >= 0.2 && <0.7, process >= 1.1 && <1.7, text >= 0.10 && <1.3, diff --git a/test/System/IO/Streams/Tests/Concurrent.hs b/test/System/IO/Streams/Tests/Concurrent.hs index 10ee136..68df43f 100644 --- a/test/System/IO/Streams/Tests/Concurrent.hs +++ b/test/System/IO/Streams/Tests/Concurrent.hs @@ -47,7 +47,7 @@ testConcurrentMerge = testCase "concurrent/concurrentMerge" $ do chans inputs <- mapM Streams.chanToInput chans resultMVar <- newEmptyMVar - forkIO (Streams.concurrentMerge inputs >>= Streams.toList + _ <- forkIO (Streams.concurrentMerge inputs >>= Streams.toList >>= putMVar resultMVar) putMVar firstMVar 0 result <- takeMVar resultMVar diff --git a/test/System/IO/Streams/Tests/Network.hs b/test/System/IO/Streams/Tests/Network.hs index 45b981d..8763168 100644 --- a/test/System/IO/Streams/Tests/Network.hs +++ b/test/System/IO/Streams/Tests/Network.hs @@ -1,4 +1,5 @@ {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE CPP #-} module System.IO.Streams.Tests.Network (tests) where @@ -13,6 +14,10 @@ import System.Timeout (timeout) import Test.Framework import Test.Framework.Providers.HUnit import Test.HUnit hiding (Test) +#if MIN_VERSION_network(2,7,0) +#else +import Data.List (intercalate) +#endif ------------------------------------------------------------------------------ import qualified System.IO.Streams.Internal as Streams import qualified System.IO.Streams.Internal.Network as Streams @@ -32,10 +37,23 @@ testSocket = testCase "network/socket" $ assertEqual "ok" (Just ()) x where + -- compats +#if MIN_VERSION_network(2,7,0) + mkAddr = return . N.tupleToHostAddress + defaultPort = N.defaultPort + close = N.close + bind = N.bind +#else + mkAddr (o1,o2,o3,o4) = N.inet_addr . intercalate "." $ map show [o1,o2,o3,o4] + defaultPort = N.aNY_PORT + close = N.sClose + bind = N.bindSocket +#endif + go = do portMVar <- newEmptyMVar resultMVar <- newEmptyMVar - forkIO $ client portMVar resultMVar + _ <- forkIO $ client portMVar resultMVar server portMVar l <- takeMVar resultMVar assertEqual "testSocket" l ["ok"] @@ -43,28 +61,28 @@ testSocket = testCase "network/socket" $ client mvar resultMVar = do port <- takeMVar mvar sock <- N.socket N.AF_INET N.Stream N.defaultProtocol - addr <- N.inet_addr "127.0.0.1" + addr <- mkAddr (127, 0, 0, 1) let saddr = N.SockAddrInet port addr N.connect sock saddr (is, os) <- Streams.socketToStreams sock Streams.fromList ["", "ok"] >>= Streams.connectTo os N.shutdown sock N.ShutdownSend Streams.toList is >>= putMVar resultMVar - N.sClose sock + close sock server mvar = do sock <- N.socket N.AF_INET N.Stream N.defaultProtocol - addr <- N.inet_addr "127.0.0.1" - let saddr = N.SockAddrInet N.aNY_PORT addr - N.bindSocket sock saddr + addr <- mkAddr (127, 0, 0, 1) + let saddr = N.SockAddrInet defaultPort addr + bind sock saddr N.listen sock 5 port <- N.socketPort sock putMVar mvar port (csock, _) <- N.accept sock (is, os) <- Streams.socketToStreams csock Streams.toList is >>= flip Streams.writeList os - N.sClose csock - N.sClose sock + close csock + close sock testSocketWithError :: Test testSocketWithError = testCase "network/socket-error" $ N.withSocketsDo $ do