packages feed

pipes-network 0.4.0.0 → 0.4.0.1

raw patch · 4 files changed

+18/−16 lines, 4 filesdep ~network-simpledep ~pipesPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: network-simple, pipes

API changes (from Hackage documentation)

Files

NEWS view
@@ -1,3 +1,9 @@+# Version 0.4.0.1++* FIX: `acceptFork` now properly closes the connection socket, even in+  case of asynchronous exceptions.++ # Version 0.4.0.0  * Do not handle “Broken Pipe” errors on the `*Write*D` proxies anymore.
pipes-network.cabal view
@@ -1,5 +1,5 @@ name:               pipes-network-version:            0.4.0.0+version:            0.4.0.1 license:            BSD3 license-file:       LICENSE copyright:          Copyright (c) Renzo Carbonara 2012-2013, Paolo Capriotti 2012-2012.@@ -40,8 +40,8 @@         base           (==4.*),         bytestring     (>=0.9.2.1),         network,-        network-simple (>=0.2 && <0.3),-        pipes          (>=3.1 && <3.3),+        network-simple (>=0.2.0.1 && <0.3),+        pipes          (>=3.2 && <3.3),         pipes-safe     (>=1.1 && <1.2),         transformers   (>=0.2 && <0.4)     exposed-modules:
src/Control/Proxy/Network/Internal.hs view
@@ -15,7 +15,6 @@ import qualified Data.ByteString               as B import qualified Control.Exception             as E import           Data.Typeable                 (Typeable)-import qualified GHC.IO.Exception              as Eg import qualified Network.Socket                as NS import qualified Network.Socket.ByteString @@ -32,14 +31,13 @@  -- | Read up to a limited number of bytes from a socket. ----- Returns `Nothing` if the remote end closed the connection (“Broken Pipe”) or--- EOF was reached.+-- Returns `Nothing` if the remote end closed the connection or EOF was reached. recv :: NS.Socket -> Int -> IO (Maybe B.ByteString)-recv sock nbytes =-    E.handle (\Eg.IOError{Eg.ioe_type=Eg.ResourceVanished} -> return Nothing)-             (do bs <- Network.Socket.ByteString.recv sock nbytes-                 if B.null bs then return Nothing-                              else return (Just bs))+recv sock nbytes = do+     bs <- Network.Socket.ByteString.recv sock nbytes+     if B.null bs+        then return Nothing+        else return (Just bs) {-# INLINE recv #-}  -- | Writes the given bytes to the socket.
src/Control/Proxy/TCP/Safe.hs view
@@ -42,8 +42,7 @@   Timeout(..)   ) where -import           Control.Concurrent             (forkIO, ThreadId)-import qualified Control.Exception              as E+import           Control.Concurrent             (ThreadId) import           Control.Monad import qualified Control.Proxy                  as P import           Control.Proxy.Network.Internal@@ -257,9 +256,7 @@                                   -- Takes the connection socket and remote end                                   -- address.   -> P.ExceptionP p a' a b' b m ThreadId-acceptFork morph lsock f = P.hoist morph . P.tryIO $ do-    client@(csock,_) <- NS.accept lsock-    forkIO $ E.finally (f client) (NS.sClose csock)+acceptFork morph lsock k = P.hoist morph . P.tryIO $ S.acceptFork lsock k {-# INLINABLE acceptFork #-}  --------------------------------------------------------------------------------@@ -431,4 +428,5 @@         Nothing -> P.throw ex     ex = Timeout $ "socketWriteD: " <> show wait <> " microseconds." {-# INLINABLE socketWriteD #-}+