| 198 | } |
| 199 | |
| 200 | static h2_c2_transit *c2_transit_create(h2_mplx *m) |
| 201 | { |
| 202 | apr_allocator_t *allocator; |
| 203 | apr_pool_t *ptrans; |
| 204 | h2_c2_transit *transit; |
| 205 | apr_status_t rv; |
| 206 | |
| 207 | /* We create a pool with its own allocator to be used for |
| 208 | * processing a request. This is the only way to have the processing |
| 209 | * independent of its parent pool in the sense that it can work in |
| 210 | * another thread. |
| 211 | */ |
| 212 | |
| 213 | rv = apr_allocator_create(&allocator); |
| 214 | if (rv == APR_SUCCESS) { |
| 215 | apr_allocator_max_free_set(allocator, ap_max_mem_free); |
| 216 | rv = apr_pool_create_ex(&ptrans, m->pool, NULL, allocator); |
| 217 | } |
| 218 | if (rv != APR_SUCCESS) { |
| 219 | /* maybe the log goes through, maybe not. */ |
| 220 | ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, m->c1, |
| 221 | APLOGNO(10004) "h2_mplx: create transit pool"); |
| 222 | ap_abort_on_oom(); |
| 223 | return NULL; /* should never be reached. */ |
| 224 | } |
| 225 | |
| 226 | apr_allocator_owner_set(allocator, ptrans); |
| 227 | apr_pool_abort_set(abort_on_oom, ptrans); |
| 228 | apr_pool_tag(ptrans, "h2_c2_transit"); |
| 229 | |
| 230 | transit = apr_pcalloc(ptrans, sizeof(*transit)); |
| 231 | transit->pool = ptrans; |
| 232 | transit->bucket_alloc = apr_bucket_alloc_create(ptrans); |
| 233 | return transit; |
| 234 | } |
| 235 | |
| 236 | static void c2_transit_destroy(h2_c2_transit *transit) |
| 237 | { |
no test coverage detected