| 1456 | } |
| 1457 | |
| 1458 | static bool runtime_worker_commit_admission(cbm_daemon_runtime_worker_t *worker) { |
| 1459 | cbm_daemon_runtime_service_t *service = worker->service; |
| 1460 | cbm_mutex_lock(&service->mutex); |
| 1461 | bool committed = service->state == CBM_DAEMON_RUNTIME_SERVICE_RUNNING && worker->admitted && |
| 1462 | !worker->admission_committed; |
| 1463 | if (committed) { |
| 1464 | worker->admission_committed = true; |
| 1465 | service->committed_clients++; |
| 1466 | /* A freshly committed client ends any last-client linger window; the |
| 1467 | * next drop to zero re-arms it against the participants outstanding |
| 1468 | * then. */ |
| 1469 | service->ephemeral_linger_deadline_ms = 0; |
| 1470 | } |
| 1471 | cbm_mutex_unlock(&service->mutex); |
| 1472 | if (committed) { |
| 1473 | /* Mirror the cleared linger onto the coordinator. client_count is |
| 1474 | * already nonzero (admission incremented it), so this only resets the |
| 1475 | * hold for the next idle window — it never retires a live coordinator. */ |
| 1476 | cbm_daemon_coordinator_set_linger(service->coordinator, false); |
| 1477 | } |
| 1478 | return committed; |
| 1479 | } |
| 1480 | |
| 1481 | static bool runtime_worker_handle_subscribe(cbm_daemon_runtime_worker_t *worker, |
| 1482 | const uint8_t *payload, uint32_t length) { |
no test coverage detected