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

Function cbm_daemon_client_disconnected

src/daemon/daemon.c:447–472  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

445}
446
447bool cbm_daemon_client_disconnected(cbm_daemon_coordinator_t *coordinator,
448 cbm_daemon_client_id_t client_id, uint64_t now_ms) {
449 (void)now_ms;
450 if (!coordinator || client_id == CBM_DAEMON_CLIENT_ID_INVALID) {
451 return false;
452 }
453
454 cbm_daemon_callback_batch_t batch;
455 cbm_mutex_lock(&coordinator->mutex);
456 callback_batch_init_locked(coordinator, &batch);
457 cbm_daemon_client_t **cursor = &coordinator->clients;
458 while (*cursor && (*cursor)->id != client_id) {
459 cursor = &(*cursor)->next;
460 }
461 if (!*cursor) {
462 cbm_mutex_unlock(&coordinator->mutex);
463 return false;
464 }
465 cbm_daemon_client_t *client = *cursor;
466 *cursor = client->next;
467 release_client_locked(coordinator, client, &batch);
468 cbm_mutex_unlock(&coordinator->mutex);
469
470 callback_batch_run(coordinator, &batch);
471 return true;
472}
473
474bool cbm_daemon_client_heartbeat(cbm_daemon_coordinator_t *coordinator,
475 cbm_daemon_client_id_t client_id, uint64_t now_ms) {

Callers 2

test_daemon.cFile · 0.85

Calls 5

cbm_mutex_lockFunction · 0.85
cbm_mutex_unlockFunction · 0.85
release_client_lockedFunction · 0.85
callback_batch_runFunction · 0.85

Tested by

no test coverage detected