network 3.0.0.0 → 3.0.0.1
raw patch · 6 files changed
+43/−15 lines, 6 files
Files
- CHANGELOG.md +6/−1
- Network/Socket/Syscall.hs +1/−1
- README.md +14/−8
- configure.ac +1/−1
- network.cabal +1/−1
- tests/SimpleSpec.hs +20/−3
CHANGELOG.md view
@@ -1,3 +1,8 @@+## Version 3.0.0.1++* Fixed a bug in `connect` where exceptions were not thrown+ [#368](https://github.com/haskell/network/pull/368)+ ## Version 3.0.0.0 * Breaking change: the Network and Network.BSD are removed.@@ -8,7 +13,7 @@ new fdSocket :: Socket -> IO CInt old mkSocket :: CInt -> Family -> SocketType -> ProtocolNumber -> SocketStatus -> IO Socket-new mkSocket :: CInt Socket+new mkSocket :: CInt -> IO Socket ``` * Breaking change: the deprecated APIs are removed: send, sendTo, recv, recvFrom, recvLen, htonl, ntohl, inet_addr, int_ntoa, bindSocket, sClose, SocketStatus, isConnected, isBound, isListening, isReadable, isWritable, sIsConnected, sIsBound, sIsListening, sIsReadable, sIsWritable, aNY_PORT, iNADDR_ANY, iN6ADDR_ANY, sOMAXCONN, sOL_SOCKET, sCM_RIGHTS, packSocketType, getPeerCred. * Breaking chage: SockAddrCan is removed from SockAddr.
Network/Socket/Syscall.hs view
@@ -160,7 +160,7 @@ fd <- fromIntegral <$> fdSocket s threadWaitWrite fd err <- getSocketOption s SoError- when (err == -1) $ throwSocketErrorCode errLoc (fromIntegral err)+ when (err /= 0) $ throwSocketErrorCode errLoc (fromIntegral err) #endif -----------------------------------------------------------------------------
README.md view
@@ -53,14 +53,20 @@ See https://github.com/haskell/network/issues/296 -- Making `Network` deprecated-- Making `Network.BSD` deprecated-- Making `MkSocket` deprecated-- Making many APIs deprecated+- [x] Making `Network` deprecated+- [x] Making `Network.BSD` deprecated+- [x] Making `MkSocket` deprecated+- [x] Making many APIs deprecated +### 2.8++- [x] Stop exporting the `PortNum` Constructor in `PortNumber`+ ### 3.0 -- Removing `Network`-- Removing `Network.BSD`-- Removing `SockAddrCan`-- Changing the internal structure of `Socket`.+- [x] Removing `Network`+- [x] Removing `Network.BSD`+- [x] Removing `SockAddrCan`+- [x] Changing the internal structure of `Socket`.+- [x] Make address extensible.+- [x] Remove EOF errors
configure.ac view
@@ -1,5 +1,5 @@ AC_INIT([Haskell network package],- [3.0.0.0],+ [3.0.0.1], [libraries@haskell.org], [network])
network.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: network-version: 3.0.0.0+version: 3.0.0.1 license: BSD3 license-file: LICENSE maintainer: Kazu Yamamoto, Evan Borden
tests/SimpleSpec.hs view
@@ -5,7 +5,7 @@ module SimpleSpec (main, spec) where import Control.Concurrent (ThreadId, forkIO, myThreadId)-import Control.Concurrent.MVar (newEmptyMVar, putMVar, takeMVar, readMVar)+import Control.Concurrent.MVar (MVar, newEmptyMVar, putMVar, takeMVar, readMVar) import qualified Control.Exception as E import Control.Monad import Data.ByteString (ByteString)@@ -111,6 +111,18 @@ client sock = send sock testMsg tcpTest client server+ describe "connect" $ do+ let+ hints = defaultHints { addrSocketType = Stream }+ connect' serverPort = do+ addr:_ <- getAddrInfo (Just hints) (Just serverAddr) (Just $ show serverPort)+ sock <- socket (addrFamily addr) (addrSocketType addr) (addrProtocol addr)+ connect sock (addrAddress addr)+ return sock+ it "fails to connect and throws an IOException" $ do+ connect' (8080 :: Int) `shouldThrow` anyIOException+ it "successfully connects to a socket with no exception" $ do+ tcpTestUsingClient return return $ readMVar >=> connect' describe "UserTimeout" $ do it "can be set" $ do@@ -244,8 +256,7 @@ -- closed after the actions have run. tcpTest :: (Socket -> IO a) -> (Socket -> IO b) -> IO () tcpTest clientAct serverAct = do- portVar <- newEmptyMVar- test (clientSetup portVar) clientAct (serverSetup portVar) server+ tcpTestUsingClient serverAct clientAct clientSetup where clientSetup portVar = do let hints = defaultHints { addrSocketType = Stream }@@ -260,6 +271,12 @@ connect sock $ addrAddress addr return sock +tcpTestUsingClient+ :: (Socket -> IO a) -> (Socket -> IO b) -> (MVar PortNumber -> IO Socket) -> IO ()+tcpTestUsingClient serverAct clientAct clientSetup = do+ portVar <- newEmptyMVar+ test (clientSetup portVar) clientAct (serverSetup portVar) server+ where serverSetup portVar = do let hints = defaultHints { addrFlags = [AI_PASSIVE]