static void response_pool_create(uint32_t max) { struct response *rsp; if (rspp_init) { log_warn("response pool has already been created, re-creating"); response_pool_destroy(); } log_info("creating response pool: max %"PRIu32, max); FREEPOOL_CREATE(&rspp, max); rspp_init = true; FREEPOOL_PREALLOC(rsp, &rspp, max, next, response_create); if (rspp.nfree < max) { log_crit("cannot preallocate response pool, OOM. abort"); exit(EXIT_FAILURE); } }
static void request_pool_create(uint32_t max) { struct request *req; if (reqp_init) { log_warn("request pool has already been created, re-creating"); request_pool_destroy(); } log_info("creating request pool: max %"PRIu32, max); FREEPOOL_CREATE(&reqp, max); reqp_init = true; FREEPOOL_PREALLOC(req, &reqp, max, next, request_create); if (reqp.nfree < max) { log_crit("cannot preallocate request pool, OOM. abort"); exit(EXIT_FAILURE); } UPDATE_VAL(request_metrics, request_free, max); }