* Get the next connection to work on. */
| 202 | * Get the next connection to work on. |
| 203 | */ |
| 204 | static conn_rec *get_next(h2_slot *slot) |
| 205 | { |
| 206 | h2_workers *workers = slot->workers; |
| 207 | conn_rec *c = NULL; |
| 208 | ap_conn_producer_t *prod; |
| 209 | int has_more; |
| 210 | |
| 211 | slot->prod = NULL; |
| 212 | if (!APR_RING_EMPTY(&workers->prod_active, ap_conn_producer_t, link)) { |
| 213 | slot->prod = prod = APR_RING_FIRST(&workers->prod_active); |
| 214 | APR_RING_REMOVE(prod, link); |
| 215 | AP_DEBUG_ASSERT(PROD_ACTIVE == prod->state); |
| 216 | |
| 217 | c = prod->fn_next(prod->baton, &has_more); |
| 218 | if (c && has_more) { |
| 219 | APR_RING_INSERT_TAIL(&workers->prod_active, prod, ap_conn_producer_t, link); |
| 220 | wake_idle_worker(workers, slot->prod); |
| 221 | } |
| 222 | else { |
| 223 | prod->state = PROD_IDLE; |
| 224 | APR_RING_INSERT_TAIL(&workers->prod_idle, prod, ap_conn_producer_t, link); |
| 225 | } |
| 226 | if (c) { |
| 227 | ++prod->conns_active; |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | return c; |
| 232 | } |
| 233 | |
| 234 | static void* APR_THREAD_FUNC slot_run(apr_thread_t *thread, void *wctx) |
| 235 | { |
no test coverage detected