| 271 | } |
| 272 | |
| 273 | static bool frontend_should_stop(frontend_state_t *state) { |
| 274 | cbm_mutex_lock(&state->mutex); |
| 275 | /* The input-closed leg must also require that no item is IN FLIGHT: the |
| 276 | * worker consults this while deciding whether a request failure was an |
| 277 | * expected shutdown, and the final queued item after EOF has count == 0 |
| 278 | * precisely while its own forward is outstanding. Without the in_request |
| 279 | * term, any daemon-side failure of that last item was classified as an |
| 280 | * expected stop and its response silently dropped with a success exit — |
| 281 | * an unanswerable failure mode for the client. */ |
| 282 | bool stopping = |
| 283 | state->stopping || (state->input_closed && state->count == 0 && !state->in_request); |
| 284 | cbm_mutex_unlock(&state->mutex); |
| 285 | return stopping; |
| 286 | } |
| 287 | |
| 288 | static void frontend_worker_mark_done(frontend_state_t *state) { |
| 289 | cbm_mutex_lock(&state->mutex); |
no test coverage detected