| 859 | } |
| 860 | |
| 861 | static apr_status_t c2_setup_io(h2_mplx *m, conn_rec *c2, h2_stream *stream, h2_c2_transit *transit) |
| 862 | { |
| 863 | h2_conn_ctx_t *conn_ctx; |
| 864 | apr_status_t rv = APR_SUCCESS; |
| 865 | const char *action = "init"; |
| 866 | |
| 867 | rv = h2_conn_ctx_init_for_c2(&conn_ctx, c2, m, stream, transit); |
| 868 | if (APR_SUCCESS != rv) goto cleanup; |
| 869 | |
| 870 | if (!conn_ctx->beam_out) { |
| 871 | action = "create output beam"; |
| 872 | rv = h2_beam_create(&conn_ctx->beam_out, c2, conn_ctx->req_pool, |
| 873 | stream->id, "output", 0, c2->base_server->timeout); |
| 874 | if (APR_SUCCESS != rv) goto cleanup; |
| 875 | |
| 876 | h2_beam_buffer_size_set(conn_ctx->beam_out, m->stream_max_mem); |
| 877 | h2_beam_on_was_empty(conn_ctx->beam_out, c2_beam_output_write_notify, c2); |
| 878 | } |
| 879 | |
| 880 | memset(&conn_ctx->pipe_in, 0, sizeof(conn_ctx->pipe_in)); |
| 881 | if (stream->input) { |
| 882 | conn_ctx->beam_in = stream->input; |
| 883 | #if H2_USE_PIPES |
| 884 | action = "create input write pipe"; |
| 885 | rv = apr_file_pipe_create_pools(&conn_ctx->pipe_in[H2_PIPE_OUT], |
| 886 | &conn_ctx->pipe_in[H2_PIPE_IN], |
| 887 | APR_READ_BLOCK, |
| 888 | c2->pool, c2->pool); |
| 889 | if (APR_SUCCESS != rv) goto cleanup; |
| 890 | #endif |
| 891 | h2_beam_on_send(stream->input, c2_beam_input_write_notify, c2); |
| 892 | h2_beam_on_received(stream->input, c2_beam_input_read_notify, c2); |
| 893 | h2_beam_on_consumed(stream->input, c1_input_consumed, stream); |
| 894 | h2_beam_on_eagain(stream->input, c2_beam_input_read_eagain, c2); |
| 895 | if (!h2_beam_empty(stream->input)) |
| 896 | c2_beam_input_write_notify(c2, stream->input); |
| 897 | } |
| 898 | |
| 899 | cleanup: |
| 900 | stream->output = (APR_SUCCESS == rv)? conn_ctx->beam_out : NULL; |
| 901 | if (APR_SUCCESS != rv) { |
| 902 | ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, c2, |
| 903 | H2_STRM_LOG(APLOGNO(10309), stream, |
| 904 | "error %s"), action); |
| 905 | } |
| 906 | return rv; |
| 907 | } |
| 908 | |
| 909 | static conn_rec *s_next_c2(h2_mplx *m) |
| 910 | { |
no test coverage detected