| 298 | } |
| 299 | |
| 300 | apr_status_t h2_beam_create(h2_bucket_beam **pbeam, conn_rec *from, |
| 301 | apr_pool_t *pool, int id, const char *tag, |
| 302 | apr_size_t max_buf_size, |
| 303 | apr_interval_time_t timeout) |
| 304 | { |
| 305 | h2_bucket_beam *beam; |
| 306 | h2_conn_ctx_t *conn_ctx = h2_conn_ctx_get(from); |
| 307 | apr_status_t rv; |
| 308 | |
| 309 | beam = apr_pcalloc(pool, sizeof(*beam)); |
| 310 | beam->pool = pool; |
| 311 | beam->from = from; |
| 312 | beam->id = id; |
| 313 | beam->name = apr_psprintf(pool, "%s-%d-%s", |
| 314 | conn_ctx->id, id, tag); |
| 315 | |
| 316 | H2_BLIST_INIT(&beam->buckets_to_send); |
| 317 | H2_BLIST_INIT(&beam->buckets_consumed); |
| 318 | H2_BLIST_INIT(&beam->buckets_eor); |
| 319 | beam->tx_mem_limits = 1; |
| 320 | beam->max_buf_size = max_buf_size; |
| 321 | beam->timeout = timeout; |
| 322 | |
| 323 | rv = apr_thread_mutex_create(&beam->lock, APR_THREAD_MUTEX_DEFAULT, pool); |
| 324 | if (APR_SUCCESS != rv) goto cleanup; |
| 325 | rv = apr_thread_cond_create(&beam->change, pool); |
| 326 | if (APR_SUCCESS != rv) goto cleanup; |
| 327 | apr_pool_pre_cleanup_register(pool, beam, beam_cleanup); |
| 328 | |
| 329 | cleanup: |
| 330 | H2_BEAM_LOG(beam, from, APLOG_TRACE2, rv, "created", NULL); |
| 331 | *pbeam = (APR_SUCCESS == rv)? beam : NULL; |
| 332 | return rv; |
| 333 | } |
| 334 | |
| 335 | void h2_beam_buffer_size_set(h2_bucket_beam *beam, apr_size_t buffer_size) |
| 336 | { |
no outgoing calls
no test coverage detected