| 445 | } |
| 446 | |
| 447 | bool 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 | |
| 474 | bool cbm_daemon_client_heartbeat(cbm_daemon_coordinator_t *coordinator, |
| 475 | cbm_daemon_client_id_t client_id, uint64_t now_ms) { |
no test coverage detected