]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Instantiate and free slab with thread
authorNick Porter <nick@portercomputing.co.uk>
Thu, 2 Feb 2023 10:06:35 +0000 (10:06 +0000)
committerNick Porter <nick@portercomputing.co.uk>
Wed, 15 Feb 2023 16:11:33 +0000 (16:11 +0000)
src/modules/rlm_rest/rlm_rest.c

index 8086ad1d1676cfdcfd83f45b0a87bc7636fa26df..90bd1313889517a6487a8e18c8eb3bf6d927bd49 100644 (file)
@@ -1167,6 +1167,12 @@ static int mod_thread_instantiate(module_thread_inst_ctx_t const *mctx)
                return -1;
        }
 
+       if (fr_rest_slab_list_alloc(t, &t->slab, mctx->el, &inst->conn_config.reuse,
+                                   rest_conn_alloc, NULL, inst, false) < 0) {
+               ERROR("Connection handle pool instantiation failed");
+               return -1;
+       }
+
        mhandle = fr_curl_io_init(t, mctx->el, inst->multiplex);
        if (!mhandle) return -1;
 
@@ -1189,6 +1195,7 @@ static int mod_thread_detach(module_thread_inst_ctx_t const *mctx)
 
        talloc_free(t->mhandle);        /* Ensure this is shutdown before the pool */
        fr_pool_free(t->pool);
+       talloc_free(t->slab);
 
        return 0;
 }
@@ -1230,6 +1237,9 @@ static int instantiate(module_inst_ctx_t const *mctx)
                return -1;
        }
 
+       inst->conn_config.reuse.num_children = 1;
+       inst->conn_config.reuse.child_pool_size = sizeof(rlm_rest_curl_context_t);
+
        return 0;
 }