| 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) { |
| 476 | if (!coordinator || client_id == CBM_DAEMON_CLIENT_ID_INVALID) { |
| 477 | return false; |
| 478 | } |
| 479 | cbm_mutex_lock(&coordinator->mutex); |
| 480 | cbm_daemon_client_t *client = find_client_locked(coordinator, client_id); |
| 481 | bool found = client != NULL; |
| 482 | if (client && now_ms > client->last_heartbeat_ms) { |
| 483 | client->last_heartbeat_ms = now_ms; |
| 484 | } |
| 485 | cbm_mutex_unlock(&coordinator->mutex); |
| 486 | return found; |
| 487 | } |
| 488 | |
| 489 | size_t cbm_daemon_expire_leases(cbm_daemon_coordinator_t *coordinator, uint64_t now_ms) { |
| 490 | if (!coordinator) { |
no test coverage detected