| 450 | } |
| 451 | |
| 452 | bool cbm_daemon_client_heartbeat(cbm_daemon_coordinator_t *coordinator, |
| 453 | cbm_daemon_client_id_t client_id, uint64_t now_ms) { |
| 454 | if (!coordinator || client_id == CBM_DAEMON_CLIENT_ID_INVALID) { |
| 455 | return false; |
| 456 | } |
| 457 | cbm_mutex_lock(&coordinator->mutex); |
| 458 | cbm_daemon_client_t *client = find_client_locked(coordinator, client_id); |
| 459 | bool found = client != NULL; |
| 460 | if (client && now_ms > client->last_heartbeat_ms) { |
| 461 | client->last_heartbeat_ms = now_ms; |
| 462 | } |
| 463 | cbm_mutex_unlock(&coordinator->mutex); |
| 464 | return found; |
| 465 | } |
| 466 | |
| 467 | size_t cbm_daemon_expire_leases(cbm_daemon_coordinator_t *coordinator, uint64_t now_ms) { |
| 468 | if (!coordinator) { |
no test coverage detected