return h2_session_create_int(r->connection, r, config, workers);
}
-void h2_session_cleanup(h2_session *session)
+static void h2_session_cleanup(h2_session *session)
{
AP_DEBUG_ASSERT(session);
+ /* This is an early cleanup of the session that may
+ * discard what is no longer necessary for *new* streams
+ * and general HTTP/2 processing.
+ * At this point, all frames are in transit or somehwere in
+ * our buffers or passed down output filters.
+ * h2 streams might still being written out.
+ */
+ if (session->mplx) {
+ h2_mplx_release_and_join(session->mplx, session->iowait);
+ session->mplx = NULL;
+ }
if (session->ngh2) {
nghttp2_session_del(session->ngh2);
session->ngh2 = NULL;
apr_pool_destroy(session->spare);
session->spare = NULL;
}
- if (session->mplx) {
- h2_mplx_release_and_join(session->mplx, session->iowait);
- session->mplx = NULL;
- }
}
void h2_session_destroy(h2_session *session)
{
apr_pool_t *pool = h2_stream_detach_pool(stream);
- h2_mplx_stream_done(session->mplx, stream->id, stream->rst_error);
- if (session->last_stream == stream) {
- session->last_stream = NULL;
+ /* this may be called while the session has already freed
+ * some internal structures. */
+ if (session->mplx) {
+ h2_mplx_stream_done(session->mplx, stream->id, stream->rst_error);
+ if (session->last_stream == stream) {
+ session->last_stream = NULL;
+ }
+ }
+
+ if (session->streams) {
+ h2_stream_set_remove(session->streams, stream->id);
}
- h2_stream_set_remove(session->streams, stream->id);
h2_stream_destroy(stream);
if (pool) {
*/
void h2_session_destroy(h2_session *session);
-/**
- * Cleanup session data while winding down. No new streams
- * may be created afterwards, but existing stream can still be
- * looked up.
- * Called automatically on destroy.
- */
-void h2_session_cleanup(h2_session *session);
-
/**
* Cleanup the session and all objects it still contains. This will not
* destroy h2_task instances that have not finished yet.
if (status != APR_SUCCESS) {
ap_log_cerror(APLOG_MARK, APLOG_DEBUG, status, stream->session->mplx->c,
"h2_stream(%ld-%d): flushing input data",
- stream->session->mplx->id, stream->id);
+ stream->session->id, stream->id);
}
}
return status;