Beispiel #1
0
static void reap_zombies(h2_session *session) {
    h2_mplx_cleanup(session->mplx);
    if (session->zombies) {
        /* remove all zombies, where the task has run */
        h2_stream_set_iter(session->zombies, stream_close_finished, session);
    }
}
Beispiel #2
0
void h2_session_log_stats(h2_session *session)
{
    AP_DEBUG_ASSERT(session);
    ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, session->c,
                  "h2_session(%ld): %d open streams",
                  session->id, (int)h2_stream_set_size(session->streams));
    h2_stream_set_iter(session->streams, log_stream, session);
}
Beispiel #3
0
void h2_session_log_stats(h2_session *session)
{
    assert(session);
    ap_log_cerror(APLOG_MARK, APLOG_INFO, 0, session->c,
                  "h2_session(%ld): %ld open streams",
                  session->id, h2_stream_set_size(session->streams));
    h2_stream_set_iter(session->streams, log_stream, session);
}
Beispiel #4
0
static int h2_session_resume_streams_with_data(h2_session *session) {
    AP_DEBUG_ASSERT(session);
    if (!h2_stream_set_is_empty(session->streams)
        && session->mplx && !session->aborted) {
        resume_ctx ctx;
        
        ctx.session      = session;
        ctx.resume_count = 0;

        /* Resume all streams where we have data in the out queue and
         * which had been suspended before. */
        h2_stream_set_iter(session->streams, resume_on_data, &ctx);
        return ctx.resume_count;
    }
    return 0;
}
Beispiel #5
0
void h2_session_destroy(h2_session *session)
{
    assert(session);
    if (session->streams) {
        if (h2_stream_set_size(session->streams)) {
            ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c,
                          "h2_session(%ld): destroy, %ld streams open",
                          session->id, h2_stream_set_size(session->streams));
            /* destroy all sessions, join all existing tasks */
            h2_stream_set_iter(session->streams, close_active_iter, session);
            ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c,
                          "h2_session(%ld): destroy, %ld streams remain",
                          session->id, h2_stream_set_size(session->streams));
        }
        h2_stream_set_destroy(session->streams);
        session->streams = NULL;
    }
    if (session->zombies) {
        if (h2_stream_set_size(session->zombies)) {
            ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c,
                          "h2_session(%ld): destroy, %ld zombie streams",
                          session->id, h2_stream_set_size(session->zombies));
            /* destroy all zombies, join all existing tasks */
            h2_stream_set_iter(session->zombies, close_zombie_iter, session);
            ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c,
                          "h2_session(%ld): destroy, %ld zombies remain",
                          session->id, h2_stream_set_size(session->zombies));
        }
        h2_stream_set_destroy(session->zombies);
        session->zombies = NULL;
    }
    if (session->ngh2) {
        nghttp2_session_del(session->ngh2);
        session->ngh2 = NULL;
    }
    if (session->mplx) {
        h2_mplx_destroy(session->mplx);
        session->mplx = NULL;
    }
    h2_conn_io_destroy(&session->io);
    
    if (session->iowait) {
        apr_thread_cond_destroy(session->iowait);
        session->iowait = NULL;
    }
    
    apr_allocator_t *allocator = session->allocator;
    if (session->alock) {
        if (allocator) {
            apr_allocator_mutex_set(allocator, session->alock);
        }
        apr_thread_mutex_destroy(session->alock);
        session->alock = NULL;
    }
    if (session->pool) {
        apr_pool_destroy(session->pool);
    }
    if (allocator) {
        apr_allocator_destroy(allocator);
    }
}