Copyright | (c) 2014-2016 Peter Trško |
---|---|
License | BSD3 |
Maintainer | peter.trsko@gmail.com |
Stability | unstable (internal module) |
Portability | GHC specific language extensions. |
Safe Haskell | None |
Language | Haskell2010 |
Module defines helper functions that would be ideally provided by streaming-commons package and some wrappers with specialised type signatures.
Internal packages are here to provide access to internal definitions for library writers, but they should not be used in application code.
Preferably use qualified import, e.g.:
import qualified Data.ConnectionPool.Internal.Streaming as Internal
This module doesn't neither depend on resource-pool package nor any other module of this package, with notable exception of Data.ConnectionPool.Internal.HandlerParams, and it shoud stay that way. This module uses CPP to get OS specific things right. Most importantly Windows doesn't support UNIX Sockets.
Please, bear above in mind when doing modifications.
- acquireTcpClientConnection :: ClientSettings -> IO (Socket, SockAddr)
- runTcpApp :: Maybe SockAddr -> (AppData -> m r) -> HandlerParams -> Socket -> SockAddr -> m r
- runTcpAppImpl :: Maybe SockAddr -> Socket -> SockAddr -> Int -> (AppData -> m r) -> m r
- fromClientSettings :: ClientSettings -> HandlerParams
- runUnixApp :: (AppDataUnix -> m r) -> HandlerParams -> Socket -> () -> m r
- runUnixAppImpl :: Socket -> Int -> (AppDataUnix -> m r) -> m r
- fromClientSettingsUnix :: ClientSettingsUnix -> HandlerParams
TCP
acquireTcpClientConnection :: ClientSettings -> IO (Socket, SockAddr) Source #
Wrapper for getSocketFamilyTCP
that takes ClientSettings
instead of
individual parameters.
:: Maybe SockAddr | |
-> (AppData -> m r) | |
-> HandlerParams | Parameters passed down to connection handler |
-> Socket | |
-> SockAddr | |
-> m r |
Wrapper for runTcpAppImpl
with a type signature that is more natural
for implementing a TCP specific
withConnection
.
Definition changed in version 0.1.3 and 0.2.1.
:: Maybe SockAddr | |
-> Socket | |
-> SockAddr | |
-> Int | Buffer size used while reading from socket. Since version 0.1.3. |
-> (AppData -> m r) | |
-> m r |
Simplified runTCPClient
and
runTCPServer
that provides only construction of
AppData
and passing it to a callback function.
Definition changed in version 0.1.3 and 0.2.1.
fromClientSettings :: ClientSettings -> HandlerParams Source #
Construct HandlerParams
that are passed to individual TCP connection
handlers.
Since version 0.1.3.
Unix Socket
:: (AppDataUnix -> m r) | |
-> HandlerParams | Parameters passed down to connection handler |
-> Socket | |
-> () | |
-> m r |
Wrapper for runUnixAppImpl
with a type signature that is more natural
for implementing a UNIX Socket specific
withConnection
.
Definition changed in version 0.1.3 and 0.2.1.
:: Socket | |
-> Int | Buffer size used while reading from socket. Since version 0.1.3. |
-> (AppDataUnix -> m r) | |
-> m r |
Simplified runUnixClient
and
runUnixServer
that provides only construction of
AppDataUnix
and passing it to a callback function.
Definition changed in version 0.1.3 and 0.2.1.
fromClientSettingsUnix :: ClientSettingsUnix -> HandlerParams Source #
Construct HandlerParams
that are passed to individual UNIX socket
connection handlers.
Since version 0.1.3.