MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cbm_http_server_free

Function cbm_http_server_free

src/ui/http_server.c:3506–3529  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3504}
3505
3506bool cbm_http_server_free(cbm_http_server_t *srv) {
3507 if (!srv)
3508 return true;
3509 int run_state = atomic_load_explicit(&srv->run_state, memory_order_acquire);
3510 if (run_state == HTTP_RUN_SCHEDULED || run_state == HTTP_RUN_RUNNING)
3511 return false;
3512 for (int i = 0; i < MAX_INDEX_JOBS; i++) {
3513 if (srv->index_jobs[i].thread_started) {
3514 if (!atomic_load_explicit(&srv->index_jobs[i].completed, memory_order_acquire))
3515 return false;
3516 if (cbm_thread_join(&srv->index_jobs[i].thread) != 0)
3517 return false;
3518 srv->index_jobs[i].thread_started = false;
3519 }
3520 }
3521 if (!cbm_httpd_close(srv->listener))
3522 return false;
3523 cbm_atlas_impact_analysis_shutdown();
3524 cbm_mcp_server_free(srv->mcp);
3525 cbm_ui_log_close();
3526 cbm_secure_zero(srv->readiness_secret, sizeof(srv->readiness_secret));
3527 free(srv);
3528 return true;
3529}
3530
3531void cbm_http_server_stop(cbm_http_server_t *srv) {
3532 if (srv) {

Calls 6

cbm_thread_joinFunction · 0.85
cbm_httpd_closeFunction · 0.85
cbm_mcp_server_freeFunction · 0.85
cbm_ui_log_closeFunction · 0.85
cbm_secure_zeroFunction · 0.85

Tested by 5

th_server_startFunction · 0.68
th_server_stopFunction · 0.68
th_ui_index_probeFunction · 0.68