network-transport-tcp 0.7.0 → 0.8.0
raw patch · 5 files changed
+38/−27 lines, 5 filesdep ~networkdep ~network-transport-testsPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: network, network-transport-tests
API changes (from Hackage documentation)
Files
- ChangeLog +8/−1
- network-transport-tcp.cabal +5/−5
- src/Network/Transport/TCP.hs +2/−2
- src/Network/Transport/TCP/Internal.hs +8/−8
- tests/TestTCP.hs +15/−11
ChangeLog view
@@ -2,10 +2,17 @@ * +2020-10-09 FacundoDominguez <facundo.dominguez@tweag.io> 0.8.0++* Move to network 3.+ 2019-12-31 FacundoDominguez <facundo.dominguez@tweag.io> 0.7.0 -* Relax dependency bounds to build with ghc-8.6.5 * Added support for unaddressable endpoints. (#61)++2019-12-31 FacundoDominguez <facundo.dominguez@tweag.io> 0.6.1++* Relax dependency bounds to build with ghc-8.6.5 * apiSend RELY violation is removed for closed remote endpoints (#70) * The server no longer needs crash if accept throws an exception. * Check peer-reported host against socket host (#54)
network-transport-tcp.cabal view
@@ -1,5 +1,5 @@ Name: network-transport-tcp-Version: 0.7.0+Version: 0.8.0 Cabal-Version: >=1.10 Build-Type: Simple License: BSD3@@ -12,7 +12,7 @@ Bug-Reports: https://github.com/haskell-distributed/network-transport-tcp/issues Synopsis: TCP instantiation of Network.Transport Description: TCP instantiation of Network.Transport-Tested-With: GHC==7.6.3 GHC==7.8.4 GHC==7.10.3+Tested-With: GHC==8.4.4 GHC==8.6.5 GHC==8.8.4 Category: Network extra-source-files: ChangeLog @@ -31,7 +31,7 @@ data-accessor >= 0.2 && < 0.3, containers >= 0.4 && < 0.7, bytestring >= 0.9 && < 0.11,- network >= 2.6.2 && < 2.9,+ network >= 3.1 && < 3.2, uuid >= 1.3 && < 1.4 Exposed-modules: Network.Transport.TCP, Network.Transport.TCP.Internal@@ -50,8 +50,8 @@ Main-Is: TestTCP.hs Build-Depends: base >= 4.3 && < 5, bytestring >= 0.9 && < 0.11,- network-transport-tests >= 0.2.1.0 && < 0.3,- network >= 2.3 && < 2.9,+ network-transport-tests >= 0.3 && < 0.4,+ network >= 3.1 && < 3.2, network-transport, network-transport-tcp ghc-options: -threaded -rtsopts -with-rtsopts=-N
src/Network/Transport/TCP.hs view
@@ -89,6 +89,7 @@ , ServiceName , Socket , getAddrInfo+ , maxListenQueue , socket , addrFamily , addrAddress@@ -98,7 +99,6 @@ , SocketOption(ReuseAddr, NoDelay, UserTimeout, KeepAlive) , isSupportedSocketOption , connect- , sOMAXCONN , AddrInfo , SockAddr(..) )@@ -675,7 +675,7 @@ -- | Default TCP parameters defaultTCPParameters :: TCPParameters defaultTCPParameters = TCPParameters {- tcpBacklog = N.sOMAXCONN+ tcpBacklog = N.maxListenQueue , tcpReuseServerAddr = True , tcpReuseClientAddr = True , tcpNoDelay = False
src/Network/Transport/TCP/Internal.hs view
@@ -42,6 +42,7 @@ import qualified Network.Socket as N #endif ( HostName+ , NameInfoFlag(NI_NUMERICHOST) , ServiceName , Socket , SocketType(Stream)@@ -49,19 +50,18 @@ , getAddrInfo , defaultHints , socket- , bindSocket+ , bind , listen , addrFamily , addrAddress , defaultProtocol , setSocketOption , accept- , sClose+ , close , socketPort , shutdown , ShutdownCmd(ShutdownBoth) , SockAddr(..)- , inet_ntoa , getNameInfo ) @@ -235,13 +235,13 @@ bracketOnError (N.socket (N.addrFamily addr) N.Stream N.defaultProtocol) tryCloseSocket $ \sock -> do when reuseAddr $ N.setSocketOption sock N.ReuseAddr 1- N.bindSocket sock (N.addrAddress addr)+ N.bind sock (N.addrAddress addr) N.listen sock backlog -- Close up and fill the synchonizing MVar. let release :: ((N.Socket, N.SockAddr), MVar ()) -> IO () release ((sock, _), socketClosed) =- N.sClose sock `finally` putMVar socketClosed ()+ N.close sock `finally` putMVar socketClosed () -- Run the request handler. let act restore (sock, sockAddr) = do@@ -263,7 +263,7 @@ -- Looks like 'act' will never throw an exception, but to be -- safe we'll close the socket if it does. let handler :: SomeException -> IO ()- handler _ = N.sClose sock+ handler _ = N.close sock catch (act restore (sock, sockAddr)) handler -- We start listening for incoming requests in a separate thread. When@@ -296,7 +296,7 @@ -- | Close a socket, ignoring I/O exceptions. tryCloseSocket :: N.Socket -> IO () tryCloseSocket sock = void . tryIO $- N.sClose sock+ N.close sock -- | Shutdown socket sends and receives, ignoring I/O exceptions. tryShutdownSocketBoth :: N.Socket -> IO ()@@ -330,7 +330,7 @@ (mResolvedHost, mResolvedPort) <- N.getNameInfo [] True False sockAddr case (mResolvedHost, mResolvedPort) of (Just resolvedHost, Nothing) -> do- numericHost <- N.inet_ntoa host+ (Just numericHost, _) <- N.getNameInfo [N.NI_NUMERICHOST] True False sockAddr return $ Just (numericHost, resolvedHost, show port) _ -> error $ concat [ "decodeSockAddr: unexpected resolution "
tests/TestTCP.hs view
@@ -64,7 +64,7 @@ #else import qualified Network.Socket as N #endif- ( sClose+ ( close , ServiceName , Socket , AddrInfo@@ -92,7 +92,7 @@ import GHC.IO.Exception (ioe_errno) import Foreign.C.Error (Errno(..), eADDRNOTAVAIL) import System.Timeout (timeout)-import Network.Transport.Tests (testTransport)+import Network.Transport.Tests (testTransportWithFilter) import Network.Transport.Tests.Auxiliary (forkTry, runTests) import Network.Transport.Tests.Traced @@ -199,7 +199,7 @@ sendMany sock (encodeWord32 10002 : prependLength ["pong"]) -- Close the socket- N.sClose sock+ N.close sock let ourAddress = encodeEndPointAddress "127.0.0.1" clientPort 0 putMVar clientAddr ourAddress@@ -215,7 +215,7 @@ -- Close the socket without closing the connection explicitly -- The server should receive an error event- N.sClose sock+ N.close sock -- | Test the behaviour of a premature CloseSocket request testEarlyCloseSocket :: IO ()@@ -316,7 +316,7 @@ encodeWord32 (encodeControlHeader CloseSocket) , encodeWord32 1024 ]- N.sClose sock+ N.close sock let ourAddress = encodeEndPointAddress "127.0.0.1" clientPort 0 putMVar clientAddr ourAddress@@ -336,7 +336,7 @@ encodeWord32 (encodeControlHeader CloseSocket) , encodeWord32 0 ]- N.sClose sock+ N.close sock -- | Test the creation of a transport with an invalid address testInvalidAddress :: IO ()@@ -451,7 +451,7 @@ encodeWord32 (encodeControlHeader CloseSocket) , encodeWord32 1024 ]- N.sClose sock+ N.close sock putMVar clientDone () @@ -576,9 +576,9 @@ -- We might get either Invalid or Crossed (the transport does not -- maintain enough history to be able to tell) Right (_, sock, ConnectionRequestInvalid) ->- N.sClose sock+ N.close sock Right (_, sock, ConnectionRequestCrossed) ->- N.sClose sock+ N.close sock Left _ -> return () putMVar done ()@@ -1113,7 +1113,7 @@ , ("EarlyCloseSocket", testEarlyCloseSocket) , ("IgnoreCloseSocket", testIgnoreCloseSocket) , ("BlockAfterCloseSocket", testBlockAfterCloseSocket)- , ("UnnecessaryConnect", testUnnecessaryConnect 10)+ -- , ("UnnecessaryConnect", testUnnecessaryConnect 10) -- flaky: #91 , ("InvalidAddress", testInvalidAddress) , ("InvalidConnect", testInvalidConnect) , ("Many", testMany)@@ -1129,9 +1129,13 @@ , ("UnreachableConnect", testUnreachableConnect) ] -- Run the generic tests even if the TCP specific tests failed..- testTransport (either (Left . show) (Right) <$>+ testTransportWithFilter (`notElem` flakies) (either (Left . show) (Right) <$> createTransport (defaultTCPAddr "127.0.0.1" "0") defaultTCPParameters) -- ..but if the generic tests pass, still fail if the specific tests did not case tcpResult of Left err -> throwIO err Right () -> return ()+ where+ flakies =+ [ "ParallelConnects" -- #92+ ]