Connection pool
| Namespace: | dmConnectionPool | 
| Include: | #include <dmsdk/dlib/connection_pool.h> | 
| TYPES | |
|---|---|
| HConnection | Connection handle | 
| HPool | Connection pool handle | 
| ENUMS | |
|---|---|
| dmConnectionPool::Result | result enumeration | 
| STRUCTS | |
|---|---|
| struct Params | Creation parameters | 
void Close(dmConnectionPool::HPool pool, dmConnectionPool::HConnection connection)
Close connection. Use this function whenever an error occur in eg http.
PARAMETERS
| dmConnectionPool::HPool | pool | pool | 
| dmConnectionPool::HConnection | connection | 
 Delete(dmConnectionPool::HPool pool)
Delete connnection pool
PARAMETERS
| dmConnectionPool::HPool | pool | pool | 
RETURNS
|  | on success | 
 Dial(dmConnectionPool::HPool pool, const char* host, uint16_t port, bool ssl, int timeout, dmConnectionPool::HConnection* connection, dmSocket::Result* sock_res)
Connection to a host/port
PARAMETERS
| dmConnectionPool::HPool | pool | pool | 
| const char* | host | host | 
| uint16_t | port | port | 
| bool | ssl | true for ssl connection | 
| int | timeout | The timeout (micro seconds) for the connection and ssl handshake | 
| dmConnectionPool::HConnection* | connection | connection (out) | 
| dmSocket::Result* | sock_res | socket-result code on failure | 
RETURNS
|  | on success | 
 Dial(dmConnectionPool::HPool pool, const char* host, uint16_t port, bool ssl, int timeout, int* cancelflag, dmConnectionPool::HConnection* connection, dmSocket::Result* sock_res)
Connection to a host/port
PARAMETERS
| dmConnectionPool::HPool | pool | pool | 
| const char* | host | host | 
| uint16_t | port | port | 
| bool | ssl | true for ssl connection | 
| int | timeout | The timeout (micro seconds) for the connection and ssl handshake | 
| int* | cancelflag | If set and not null, will make the request early out | 
| dmConnectionPool::HConnection* | connection | connection (out) | 
| dmSocket::Result* | sock_res | socket-result code on failure | 
RETURNS
|  | on success | 
dmSocket::Socket GetSocket(dmConnectionPool::HPool pool, dmConnectionPool::HConnection connection)
Get socket for connection
PARAMETERS
| dmConnectionPool::HPool | pool | pool | 
| dmConnectionPool::HConnection | connection | 
RETURNS
| dmSocket::Socket | on success | 
dmSSLSocket::Socket GetSSLSocket(dmConnectionPool::HPool pool, dmConnectionPool::HConnection connection)
Get secure socket.
PARAMETERS
| dmConnectionPool::HPool | pool | pool | 
| dmConnectionPool::HConnection | connection | 
RETURNS
| dmSSLSocket::Socket | on success | 
 New(dmConnectionPool::Params* params, dmConnectionPool::HPool* pool)
Create a new connection pool
PARAMETERS
| dmConnectionPool::Params* | params | |
| dmConnectionPool::HPool* | pool | pool (out) | 
RETURNS
|  | on success | 
void Return(dmConnectionPool::HPool pool, dmConnectionPool::HConnection connection)
Return connection to pool
PARAMETERS
| dmConnectionPool::HPool | pool | pool | 
| dmConnectionPool::HConnection | connection | 
 Shutdown(dmConnectionPool::HPool pool, dmSocket::ShutdownType how)
Shuts down all open sockets in the pool and block new connection attempts. The function can be called repeatedly on the same pool until it returns no more connections in use.
PARAMETERS
| dmConnectionPool::HPool | pool | pool | 
| dmSocket::ShutdownType | how | shutdown type to pass to socket shutdown function | 
RETURNS
|  | number of connections in use | 
TYPE
struct ParamsCreation parameters
MEMBERS
| int | m_MaxConnections | Max connection in pool | 
| int | m_MaxKeepAlive | Default max-keep-alive time in seconds | 
Connection handle
Connection pool handle
Result enumeration.
| dmConnectionPool::RESULT_OK | 0 | 
| dmConnectionPool::RESULT_OUT_OF_RESOURCES | -1 | 
| dmConnectionPool::RESULT_SOCKET_ERROR | -2 | 
| dmConnectionPool::RESULT_HANDSHAKE_FAILED | -3 | 
| dmConnectionPool::RESULT_SHUT_DOWN | -4 |