network-conduit 0.6.0 → 0.6.1
raw patch · 3 files changed
+12/−2 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Data.Conduit.Network: appLocalAddr :: AppData m -> Maybe SockAddr
+ Data.Conduit.Network: serverNeedLocalAddr :: ServerSettings m -> Bool
+ Data.Conduit.Network.Internal: appLocalAddr :: AppData m -> Maybe SockAddr
+ Data.Conduit.Network.Internal: serverNeedLocalAddr :: ServerSettings m -> Bool
- Data.Conduit.Network.Internal: AppData :: Source m ByteString -> Sink ByteString m () -> SockAddr -> AppData m
+ Data.Conduit.Network.Internal: AppData :: Source m ByteString -> Sink ByteString m () -> SockAddr -> Maybe SockAddr -> AppData m
- Data.Conduit.Network.Internal: ServerSettings :: Int -> HostPreference -> (Socket -> m ()) -> ServerSettings m
+ Data.Conduit.Network.Internal: ServerSettings :: Int -> HostPreference -> (Socket -> m ()) -> Bool -> ServerSettings m
Files
Data/Conduit/Network.hs view
@@ -11,12 +11,14 @@ , appSource , appSink , appSockAddr+ , appLocalAddr -- ** Server , ServerSettings , serverSettings , serverPort , serverHost , serverAfterBind+ , serverNeedLocalAddr , runTCPServer -- ** Client , ClientSettings@@ -92,6 +94,7 @@ { serverPort = port , serverHost = host , serverAfterBind = const $ return ()+ , serverNeedLocalAddr = False } -- | Run an @Application@ with the given settings. This function will create a@@ -100,7 +103,7 @@ -- -- Since 0.6.0 runTCPServer :: (MonadIO m, MonadBaseControl IO m) => ServerSettings m -> Application m -> m ()-runTCPServer (ServerSettings port host afterBind) app = control $ \run -> bracket+runTCPServer (ServerSettings port host afterBind needLocalAddr) app = control $ \run -> bracket (liftIO $ bindPort port host) (liftIO . NS.sClose) (\socket -> run $ do@@ -109,10 +112,14 @@ where serve lsocket = do (socket, addr) <- liftIO $ acceptSafe lsocket+ mlocal <- if needLocalAddr+ then fmap Just $ liftIO (NS.getSocketName socket)+ else return Nothing let ad = AppData { appSource = sourceSocket socket , appSink = sinkSocket socket , appSockAddr = addr+ , appLocalAddr = mlocal } app' run = run (app ad) >> return () appClose run = app' run `finally` NS.sClose socket@@ -141,6 +148,7 @@ { appSource = sourceSocket s , appSink = sinkSocket s , appSockAddr = address+ , appLocalAddr = Nothing }) -- | Attempt to connect to the given host/port.
Data/Conduit/Network/Internal.hs view
@@ -18,6 +18,7 @@ { appSource :: Source m ByteString , appSink :: Sink ByteString m () , appSockAddr :: SockAddr+ , appLocalAddr :: Maybe SockAddr } -- | Settings for a TCP server. It takes a port to listen on, and an optional@@ -28,6 +29,7 @@ { serverPort :: Int , serverHost :: HostPreference , serverAfterBind :: Socket -> m ()+ , serverNeedLocalAddr :: Bool } -- | Settings for a TCP client, specifying how to connect to the server.
network-conduit.cabal view
@@ -1,5 +1,5 @@ Name: network-conduit-Version: 0.6.0+Version: 0.6.1 Synopsis: Stream socket data using conduits. Description: Stream socket data using conduits. License: BSD3