packages feed

network 3.1.0.0 → 3.1.0.1

raw patch · 11 files changed

+38/−20 lines, 11 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,3 +1,10 @@+## Version 3.1.0.1++* getAddrInfo: raise exception if no AddrInfo returned.+  [#410](https://github.com/haskell/network/pull/410)+* Avoid catching SomeException.+  [#411](https://github.com/haskell/network/pull/411)+ ## Version 3.1.0.0  * Making GC of socket safer.
Network/Socket.hs view
@@ -47,8 +47,7 @@ -- >         setSocketOption sock ReuseAddr 1 -- >         -- If the prefork technique is not used, -- >         -- set CloseOnExec for the security reasons.--- >         fd <- fdSocket sock--- >         setCloseOnExecIfNeeded fd+-- >         withFdSocket sock $ setCloseOnExecIfNeeded -- >         bind sock (addrAddress addr) -- >         listen sock 10 -- >         return sock
Network/Socket/Buffer.hs view
@@ -9,10 +9,9 @@   , recvBuf   ) where -import qualified Control.Exception as E import Foreign.Marshal.Alloc (alloca) import GHC.IO.Exception (IOErrorType(InvalidArgument))-import System.IO.Error (mkIOError, ioeSetErrorString)+import System.IO.Error (mkIOError, ioeSetErrorString, catchIOError)  #if defined(mingw32_HOST_OS) import GHC.IO.FD (FD(..), readRawBufferPtr, writeRawBufferPtr)@@ -98,7 +97,7 @@             len <- throwSocketErrorWaitRead s "Network.Socket.recvBufFrom" $                      c_recvfrom fd ptr cnbytes flags ptr_sa ptr_len             sockaddr <- peekSocketAddress ptr_sa-                `E.catch` \(E.SomeException _) -> getPeerName s+                `catchIOError` \_ -> getPeerName s             return (fromIntegral len, sockaddr)  -- | Receive data from the socket.  The socket must be in a connected
Network/Socket/Info.hsc view
@@ -282,7 +282,11 @@             ptr_addrs <- peek ptr_ptr_addrs             ais       <- followAddrInfo ptr_addrs             c_freeaddrinfo ptr_addrs-            return ais+            -- POSIX requires that getaddrinfo(3) returns at least one addrinfo.+            -- See: http://pubs.opengroup.org/onlinepubs/9699919799/functions/getaddrinfo.html+            case ais of+              [] -> ioError $ mkIOError NoSuchThing message Nothing Nothing+              _ -> pure ais           else do             err <- gai_strerror ret             ioError $ ioeSetErrorString
Network/Socket/Options.hsc view
@@ -1,6 +1,5 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE ScopedTypeVariables #-}  #include "HsNet.h" ##include "HsNetDef.h"
Network/Socket/Syscall.hs view
@@ -1,5 +1,4 @@ {-# LANGUAGE CPP #-}-{-# LANGUAGE ScopedTypeVariables #-}  #include "HsNetDef.h" @@ -7,6 +6,9 @@  import Foreign.Marshal.Utils (with) import qualified Control.Exception as E+# if defined(mingw32_HOST_OS)+import System.IO.Error (catchIOError)+#endif  #if defined(mingw32_HOST_OS) import Foreign (FunPtr)@@ -103,7 +105,7 @@ # if defined(mingw32_HOST_OS)       -- The IPv6Only option is only supported on Windows Vista and later,       -- so trying to change it might throw an error.-      E.catch (setSocketOption s IPv6Only 0) $ (\(_ :: E.IOException) -> return ())+      setSocketOption s IPv6Only 0 `catchIOError` \_ -> return () # elif defined(__OpenBSD__)       -- don't change IPv6Only       return ()
Network/Socket/Types.hsc view
@@ -208,7 +208,7 @@  ----------------------------------------------------------------------------- --- | Protocl number.+-- | Protocol number. type ProtocolNumber = CInt  -- | This is the default protocol for a given service.@@ -929,7 +929,7 @@         !FlowInfo        -- sin6_flowinfo (ditto)         !HostAddress6    -- sin6_addr (ditto)         !ScopeID         -- sin6_scope_id (ditto)-  -- | The path must have less than 104 characters. All of these characters must have code points less than 256.+  -- | The path must have fewer than 104 characters. All of these characters must have code points less than 256.   | SockAddrUnix         String           -- sun_path   deriving (Eq, Ord, Typeable)
Network/Socket/Unix.hsc view
@@ -16,11 +16,13 @@ import Network.Socket.Imports import Network.Socket.Types +#if defined(HAVE_GETPEEREID)+import System.IO.Error (catchIOError)+#endif #ifdef HAVE_STRUCT_UCRED_SO_PEERCRED import Foreign.Marshal.Utils (with) #endif #ifdef HAVE_GETPEEREID-import qualified Control.Exception as E import Foreign.Marshal.Alloc (alloca) #endif #ifdef DOMAIN_SOCKET_SUPPORT@@ -58,9 +60,12 @@       else         return (Just pid, Just uid, Just gid) #elif defined(HAVE_GETPEEREID)-getPeerCredential sock = E.handle (\(E.SomeException _) -> return (Nothing,Nothing,Nothing)) $ do-    (uid, gid) <- getPeerEid sock-    return (Nothing, Just uid, Just gid)+getPeerCredential sock =+    go `catchIOError` \_ -> return (Nothing,Nothing,Nothing)+  where+    go = do+        (uid, gid) <- getPeerEid sock+        return (Nothing, Just uid, Just gid) #else getPeerCredential _ = return (Nothing, Nothing, Nothing) #endif
configure.ac view
@@ -1,5 +1,5 @@ AC_INIT([Haskell network package],-        [3.1.0.0],+        [3.1.0.1],         [libraries@haskell.org],         [network]) 
examples/EchoServer.hs view
@@ -25,8 +25,7 @@         setSocketOption sock ReuseAddr 1         -- If the prefork technique is not used,         -- set CloseOnExec for the security reasons.-        fd <- fdSocket sock-        setCloseOnExecIfNeeded fd+        withFdSocket sock $ setCloseOnExecIfNeeded         bind sock (addrAddress addr)         listen sock 10         return sock
network.cabal view
@@ -1,6 +1,6 @@ cabal-version:  1.18 name:           network-version:        3.1.0.0+version:        3.1.0.1 license:        BSD3 license-file:   LICENSE maintainer:     Kazu Yamamoto, Evan Borden@@ -15,7 +15,11 @@   * hookup   * network-simple   .-  === Related Packages+  === Extended Packages+  @network@ seeks to provide a cross-platform core for networking. As such some+  APIs live in extended libraries. Packages in the @network@ ecosystem are+  often prefixed with @network-@.+  .   ==== @network-bsd@   In @network-3.0.0.0@ the @Network.BSD@ module was split off into its own   package, @network-bsd-3.0.0.0@.