apr_status_t h2_session_stream_destroy(h2_session *session, h2_stream *stream) { apr_pool_t *pool = h2_stream_detach_pool(stream); h2_mplx_stream_done(session->mplx, stream->id, stream->rst_error); h2_stream_set_remove(session->streams, stream->id); h2_stream_destroy(stream); if (pool) { apr_pool_clear(pool); if (session->spare) { apr_pool_destroy(session->spare); } session->spare = pool; } return APR_SUCCESS; }
static void stream_destroy(h2_mplx *m, h2_stream *stream, h2_io *io) { apr_pool_t *pool = h2_stream_detach_pool(stream); if (pool) { apr_pool_clear(pool); if (m->spare_pool) { apr_pool_destroy(m->spare_pool); } m->spare_pool = pool; } h2_stream_destroy(stream); if (io) { /* The pool is cleared/destroyed which also closes all * allocated file handles. Give this count back to our * file handle pool. */ m->file_handles_allowed += io->files_handles_owned; h2_io_set_remove(m->stream_ios, io); h2_io_destroy(io); } }