*/
typedef int (*fr_connection_alive_t)(void *opaque, void *connection);
-/** Delete a connection and free allocated memory
- *
- * Should close any sockets associated with the passed connection handle,
- * and free any memory allocated to it.
- *
- * @param[in] opaque pointer passed to fr_connection_pool_init.
- * @param[in,out] connection handle returned by fr_connection_create_t.
- * @return < 0 on error else 0 if connection was closed successfully.
- */
-typedef int (*fr_connection_delete_t)(void *opaque, void *connection);
-
fr_connection_pool_t *fr_connection_pool_init(CONF_SECTION *cs,
void *opaque,
fr_connection_create_t c,
fr_connection_alive_t a,
- fr_connection_delete_t d,
char const *prefix);
void fr_connection_pool_delete(fr_connection_pool_t *pool);
//!< connections.
fr_connection_alive_t alive; //!< Function used to check status
//!< of connections.
- fr_connection_delete_t delete; //!< Function used to close existing
- //!< connections.
};
#define LOG_PREFIX "rlm_%s (%s)"
if (pool->trigger) exec_trigger(NULL, pool->cs, "close", true);
fr_connection_unlink(pool, this);
- if (pool->delete) pool->delete(pool->opaque, this->connection);
rad_assert(pool->num > 0);
pool->num--;
talloc_free(this);
* @param[in] opaque data pointer to pass to callbacks.
* @param[in] c Callback to create new connections.
* @param[in] a Callback to check the status of connections.
- * @param[in] d Callback to delete connections.
* @param[in] prefix to prepend to all log message, if NULL will create prefix
* from parent conf section names.
* @return A new connection pool or NULL on error.
void *opaque,
fr_connection_create_t c,
fr_connection_alive_t a,
- fr_connection_delete_t d,
char const *prefix)
{
uint32_t i;
pool->opaque = opaque;
pool->create = c;
pool->alive = a;
- pool->delete = d;
pool->head = pool->tail = NULL;
}
if (pool->trigger) exec_trigger(NULL, pool->cs, "close", true);
- pool->delete(pool->opaque, conn);
this->connection = new_conn;
pthread_mutex_unlock(&pool->mutex);
+
return new_conn;
}
}
/* initiate connection pool */
- inst->pool = fr_connection_pool_init(conf, inst, mod_conn_create, mod_conn_alive, NULL, NULL);
+ inst->pool = fr_connection_pool_init(conf, inst, mod_conn_create, mod_conn_alive, NULL);
/* check connection pool */
if (!inst->pool) {
/*
* Initialize the socket pool.
*/
- inst->pool = fr_connection_pool_init(conf, inst, mod_conn_create, NULL, NULL, NULL);
+ inst->pool = fr_connection_pool_init(conf, inst, mod_conn_create, NULL, NULL);
if (!inst->pool) {
return -1;
}
/*
* Initialize the socket pool.
*/
- inst->pool = fr_connection_pool_init(inst->cs, inst, mod_conn_create, NULL, NULL, NULL);
+ inst->pool = fr_connection_pool_init(inst->cs, inst, mod_conn_create, NULL, NULL);
if (!inst->pool) {
return -1;
}
xlat_register(inst->xlat_name, redis_xlat, NULL, inst); /* FIXME! */
- inst->pool = fr_connection_pool_init(conf, inst, mod_conn_create, NULL, NULL, NULL);
+ inst->pool = fr_connection_pool_init(conf, inst, mod_conn_create, NULL, NULL);
if (!inst->pool) {
return -1;
}
return -1;
}
- inst->conn_pool = fr_connection_pool_init(conf, inst, mod_conn_create, mod_conn_alive, NULL, NULL);
+ inst->conn_pool = fr_connection_pool_init(conf, inst, mod_conn_create, mod_conn_alive, NULL);
if (!inst->conn_pool) {
return -1;
}
/*
* Initialize the socket pool.
*/
- inst->pool = fr_connection_pool_init(conf, inst, mod_conn_create, NULL, NULL, NULL);
+ inst->pool = fr_connection_pool_init(conf, inst, mod_conn_create, NULL, NULL);
if (!inst->pool) {
return -1;
}
*************************************************************************/
int sql_socket_pool_init(rlm_sql_t * inst)
{
- inst->pool = fr_connection_pool_init(inst->cs, inst, mod_conn_create, NULL, NULL, NULL);
+ inst->pool = fr_connection_pool_init(inst->cs, inst, mod_conn_create, NULL, NULL);
if (!inst->pool) return -1;
return 1;
}
snprintf(prefix, sizeof(prefix), "rlm_yubikey (%s)", inst->name);
- inst->conn_pool = fr_connection_pool_init(conf, inst, mod_conn_create, NULL, NULL, prefix);
+ inst->conn_pool = fr_connection_pool_init(conf, inst, mod_conn_create, NULL, prefix);
if (!inst->conn_pool) {
ykclient_done(&inst->ykc);