{ NULL, -1, 0, NULL, NULL } /* end the list */
};
+static int _mod_conn_free(int *fdp)
+{
+ close(*fdp);
+ return 0;
+}
-static void *mod_conn_create(void *instance)
+static void *mod_conn_create(TALLOC_CTX *ctx, void *instance)
{
int fd;
struct sockaddr_un sa;
return NULL;
}
- fdp = talloc_zero(instance, int);
+ fdp = talloc_zero(ctx, int);
+ talloc_set_destructor(fdp, _mod_conn_free);
*fdp = fd;
return fdp;
}
-static int mod_conn_delete(UNUSED void *instance, void *handle)
-{
- int *fdp = handle;
-
- close(*fdp);
- talloc_free(fdp);
- return 0;
-}
-
-
/*
* Full read with logging, and close on failure.
* Returns nread on success, 0 on EOF, -1 on other failures.
/*
* Initialize the socket pool.
*/
- inst->pool = fr_connection_pool_init(conf, inst, mod_conn_create, NULL, mod_conn_delete, NULL);
+ inst->pool = fr_connection_pool_init(conf, inst, mod_conn_create, NULL, NULL, NULL);
if (!inst->pool) {
return -1;
}