| 147 | } |
| 148 | |
| 149 | static void m_stream_cleanup(h2_mplx *m, h2_stream *stream) |
| 150 | { |
| 151 | h2_conn_ctx_t *c2_ctx = h2_conn_ctx_get(stream->c2); |
| 152 | |
| 153 | ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, m->c1, |
| 154 | H2_STRM_MSG(stream, "cleanup, unsubscribing from beam events")); |
| 155 | if (c2_ctx) { |
| 156 | if (c2_ctx->beam_out) { |
| 157 | h2_beam_on_was_empty(c2_ctx->beam_out, NULL, NULL); |
| 158 | } |
| 159 | if (c2_ctx->beam_in) { |
| 160 | h2_beam_on_send(c2_ctx->beam_in, NULL, NULL); |
| 161 | h2_beam_on_received(c2_ctx->beam_in, NULL, NULL); |
| 162 | h2_beam_on_eagain(c2_ctx->beam_in, NULL, NULL); |
| 163 | h2_beam_on_consumed(c2_ctx->beam_in, NULL, NULL); |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, m->c1, |
| 168 | H2_STRM_MSG(stream, "cleanup, removing from registries")); |
| 169 | ap_assert(stream->state == H2_SS_CLEANUP); |
| 170 | h2_stream_cleanup(stream); |
| 171 | h2_ihash_remove(m->streams, stream->id); |
| 172 | h2_iq_remove(m->q, stream->id); |
| 173 | |
| 174 | if (c2_ctx) { |
| 175 | if (!stream_is_running(stream)) { |
| 176 | ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, m->c1, |
| 177 | H2_STRM_MSG(stream, "cleanup, c2 is done, move to spurge")); |
| 178 | /* processing has finished */ |
| 179 | add_for_purge(m, stream); |
| 180 | } |
| 181 | else { |
| 182 | ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, m->c1, |
| 183 | H2_STRM_MSG(stream, "cleanup, c2 is running, abort")); |
| 184 | /* c2 is still running */ |
| 185 | h2_c2_abort(stream->c2, m->c1); |
| 186 | ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, m->c1, |
| 187 | H2_STRM_MSG(stream, "cleanup, c2 is done, move to shold")); |
| 188 | h2_ihash_add(m->shold, stream); |
| 189 | } |
| 190 | } |
| 191 | else { |
| 192 | /* never started */ |
| 193 | int added = add_for_purge(m, stream); |
| 194 | if (added) |
| 195 | ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, m->c1, |
| 196 | H2_STRM_MSG(stream, "cleanup, never started, move to spurge")); |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | static h2_c2_transit *c2_transit_create(h2_mplx *m) |
| 201 | { |
no test coverage detected