Namespace: dmConnectionPool
Language: C++
Type: Defold C++
File: connection_pool.h
Source: engine/dlib/src/dmsdk/dlib/connection_pool.h
Include: dmsdk/dlib/connection_pool.h
Connection pool
Type: FUNCTION Close connection. Use this function whenever an error occur in eg http.
Parameters
pool (dmConnectionPool::HPool) - poolconnection (dmConnectionPool::HConnection)Type: FUNCTION Delete connnection pool
Parameters
pool (dmConnectionPool::HPool) - poolReturns
dmConnectionPool::RESULT_OK - on successType: FUNCTION Connection to a host/port
Parameters
pool (dmConnectionPool::HPool) - poolhost (const char*) - hostport (uint16_t) - portssl (bool) - true for ssl connectiontimeout (int) - The timeout (micro seconds) for the connection and ssl handshakeconnection (dmConnectionPool::HConnection*) - connection (out)sock_res (dmSocket::Result*) - socket-result code on failureReturns
dmConnectionPool::RESULT_OK - on successType: FUNCTION Connection to a host/port
Parameters
pool (dmConnectionPool::HPool) - poolhost (const char*) - hostport (uint16_t) - portssl (bool) - true for ssl connectiontimeout (int) - The timeout (micro seconds) for the connection and ssl handshakecancelflag (int*) - If set and not null, will make the request early outconnection (dmConnectionPool::HConnection*) - connection (out)sock_res (dmSocket::Result*) - socket-result code on failureReturns
dmConnectionPool::RESULT_OK - on successType: ENUM Result enumeration.
Members
dmConnectionPool::RESULT_OK - 0dmConnectionPool::RESULT_OUT_OF_RESOURCES - -1dmConnectionPool::RESULT_SOCKET_ERROR - -2dmConnectionPool::RESULT_HANDSHAKE_FAILED - -3dmConnectionPool::RESULT_SHUT_DOWN - -4Type: FUNCTION Get socket for connection
Parameters
pool (dmConnectionPool::HPool) - poolconnection (dmConnectionPool::HConnection)Returns
return (dmSocket::Socket) - on successType: FUNCTION Get secure socket.
Parameters
pool (dmConnectionPool::HPool) - poolconnection (dmConnectionPool::HConnection)Returns
return (dmSSLSocket::Socket) - on successType: TYPEDEF Connection handle
Type: TYPEDEF Connection pool handle
Type: FUNCTION Create a new connection pool
Parameters
params (dmConnectionPool::Params*)pool (dmConnectionPool::HPool*) - pool (out)Returns
dmConnectionPool::RESULT_OK - on successType: STRUCT Creation parameters
Members
m_MaxConnections (int) - Max connection in poolm_MaxKeepAlive (int) - Default max-keep-alive time in secondsType: FUNCTION Return connection to pool
Parameters
pool (dmConnectionPool::HPool) - poolconnection (dmConnectionPool::HConnection)Type: FUNCTION 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
pool (dmConnectionPool::HPool) - poolhow (dmSocket::ShutdownType) - shutdown type to pass to socket shutdown functionReturns
current - number of connections in use