packages feed

network-conduit 0.2.1 → 0.2.1.1

raw patch · 3 files changed

+37/−5 lines, 3 filesdep +network-conduitdep ~basedep ~conduitPVP ok

version bump matches the API change (PVP)

Dependencies added: network-conduit

Dependency ranges changed: base, conduit

API changes (from Hackage documentation)

Files

Data/Conduit/Network.hs view
@@ -25,6 +25,7 @@ import Control.Monad.IO.Class (liftIO) import Control.Exception (bracketOnError, IOException, bracket, throwIO, SomeException, try) import Control.Monad (forever)+import Control.Monad.Trans.Resource (register) import Control.Concurrent (forkIO)  -- | Stream data from the socket.@@ -87,7 +88,9 @@   where     serve lsocket = do         (socket, _addr) <- NS.accept lsocket-        forkIO $ runResourceT $ app (sourceSocket socket) (sinkSocket socket)+        forkIO $ runResourceT $ do+            _ <- register $ NS.sClose socket+            app (sourceSocket socket) (sinkSocket socket)  -- | Settings for a TCP client, specifying how to connect to the server. data ClientSettings = ClientSettings@@ -99,9 +102,10 @@ -- -- Since 0.2.1 runTCPClient :: ClientSettings -> Application -> IO ()-runTCPClient (ClientSettings port host) app = do-    socket <- getSocket host port-    runResourceT $ app (sourceSocket socket) (sinkSocket socket)+runTCPClient (ClientSettings port host) app = bracket+    (getSocket host port)+    NS.sClose+    (\s -> runResourceT $ app (sourceSocket s) (sinkSocket s))  -- | Attempt to connect to the given host/port. --
network-conduit.cabal view
@@ -1,5 +1,5 @@ Name:                network-conduit-Version:             0.2.1+Version:             0.2.1.1 Synopsis:            Stream socket data using conduits. Description:         Stream socket data using conduits. License:             BSD3@@ -10,6 +10,7 @@ Build-type:          Simple Cabal-version:       >=1.8 Homepage:            http://github.com/snoyberg/conduit+extra-source-files:  test/main.hs  flag network-bytestring     default: False@@ -26,6 +27,16 @@   else         build-depends: network               >= 2.3     && < 2.4   ghc-options:     -Wall++test-suite test+    hs-source-dirs: test+    main-is: main.hs+    type: exitcode-stdio-1.0+    cpp-options:   -DTEST+    build-depends:   conduit+                   , base+                   , network-conduit+    ghc-options:     -Wall -threaded  source-repository head   type:     git
+ test/main.hs view
@@ -0,0 +1,17 @@+import Data.Conduit+import Data.Conduit.Network+import Control.Concurrent (forkIO, threadDelay)+import Control.Monad (replicateM_)++main :: IO ()+main = do+    _ <- forkIO $ runTCPServer (ServerSettings 4000 Nothing) echo+    threadDelay 1000+    replicateM_ 10000+        $ runTCPClient (ClientSettings 4000 "localhost") doNothing++echo :: Application+echo src sink = src $$ sink++doNothing :: Application+doNothing _ _ = return ()