apr_status_t h2_mplx_stream_done(h2_mplx *m, int stream_id, int rst_error) { apr_status_t status = APR_SUCCESS; apr_thread_mutex_t *holding; int acquired; /* This maybe called from inside callbacks that already hold the lock. * E.g. when we are streaming out DATA and the EOF triggers the stream * release. */ AP_DEBUG_ASSERT(m); if ((status = enter_mutex(m, &acquired)) == APR_SUCCESS) { h2_io *io = h2_io_set_get(m->stream_ios, stream_id); /* there should be an h2_io, once the stream has been scheduled * for processing, e.g. when we received all HEADERs. But when * a stream is cancelled very early, it will not exist. */ if (io) { io_stream_done(m, io, rst_error); } leave_mutex(m, acquired); } return status; }
apr_status_t h2_mplx_stream_done(h2_mplx *m, int stream_id, int rst_error) { apr_status_t status; AP_DEBUG_ASSERT(m); status = apr_thread_mutex_lock(m->lock); if (APR_SUCCESS == status) { h2_io *io = h2_io_set_get(m->stream_ios, stream_id); /* there should be an h2_io, once the stream has been scheduled * for processing, e.g. when we received all HEADERs. But when * a stream is cancelled very early, it will not exist. */ if (io) { io_stream_done(m, io, rst_error); } apr_thread_mutex_unlock(m->lock); } return status; }
static int stream_done_iter(void *ctx, h2_io *io) { return io_stream_done((h2_mplx*)ctx, io, 0); }