16 #ifndef _FR_CONNECTION_H
17 #define _FR_CONNECTION_H
27 RCSIDH(connection_h,
"$Id: 700294b080c0fd4303c14a0339337b09546a4dce $")
29 #include <freeradius-devel/conffile.h>
98 typedef void *(*fr_connection_create_t)(TALLOC_CTX *ctx,
void *opaque,
struct timeval const *
timeout);
123 char const *log_prefix,
124 char const *trigger_prefix);
void const * fr_connection_pool_opaque(fr_connection_pool_t *pool)
Return the opaque data associated with a connection pool.
int(* fr_connection_alive_t)(void *opaque, void *connection)
Check a connection handle is still viable.
bool reconnecting
We are currently reconnecting the pool.
time_t last_checked
Last time we pruned the connection pool.
void fr_connection_pool_reconnect_func(fr_connection_pool_t *pool, fr_connection_pool_reconnect_t reconnect)
Set a reconnection callback for the connection pool.
void(* fr_connection_pool_reconnect_t)(void *opaque)
Alter the opaque data of a connection pool during reconnection event.
struct timeval last_released
Last time a connection was released.
time_t last_spawned
Last time we spawned a connection.
uint32_t active
Number of currently reserved connections.
struct timeval fr_connection_pool_timeout(fr_connection_pool_t *pool)
Connection pool get timeout.
struct fr_connection_pool_state fr_connection_pool_state_t
time_t last_failed
Last time we tried to spawn a connection but failed.
time_t last_throttled
Last time we refused to spawn a connection because the last connection failed, or we were already spa...
void fr_connection_pool_ref(fr_connection_pool_t *pool)
Increment pool reference by one.
uint32_t num
Number of connections in the pool.
void * fr_connection_get(fr_connection_pool_t *pool)
Reserve a connection in the connection pool.
int fr_connection_pool_reconnect(fr_connection_pool_t *pool)
Mark connections for reconnection, and spawn at least 'start' connections.
int fr_connection_close(fr_connection_pool_t *pool, void *conn)
Delete a connection from the connection pool.
time_t last_at_max
Last time we hit the maximum number of allowed connections.
struct timeval last_closed
Last time a connection was closed.
fr_connection_pool_t * fr_connection_pool_init(TALLOC_CTX *ctx, CONF_SECTION *cs, void *opaque, fr_connection_create_t c, fr_connection_alive_t a, char const *log_prefix, char const *trigger_prefix)
Create a new connection pool.
uint64_t count
Number of connections spawned over the lifetime of the pool.
void fr_connection_release(fr_connection_pool_t *pool, void *conn)
Release a connection.
fr_connection_pool_t * fr_connection_pool_copy(TALLOC_CTX *ctx, fr_connection_pool_t *pool, void *opaque)
Allocate a new pool using an existing one as a template.
void *(* fr_connection_create_t)(TALLOC_CTX *ctx, void *opaque, struct timeval const *timeout)
Create a new connection handle.
int next_delay
The next delay time.
fr_connection_pool_state_t const * fr_connection_pool_state(fr_connection_pool_t *pool)
Get the number of connections currently in the pool.
void * fr_connection_reconnect(fr_connection_pool_t *pool, void *conn)
Reconnect a suspected inviable connection.
uint32_t pending
Number of pending open connections.
void fr_connection_pool_free(fr_connection_pool_t *pool)
Delete a connection pool.