static void validate_tree(nghttp2_stream *stream) { nghttp2_stream *si; if (!stream) { return; } for (; stream->dep_prev; stream = stream->dep_prev) ; assert(stream->stream_id == 0); assert(!stream->queued); fprintf(stderr, "checking...\n"); if (nghttp2_pq_empty(&stream->obq)) { fprintf(stderr, "root obq empty\n"); for (si = stream->dep_next; si; si = si->sib_next) { ensure_inactive(si); } } else { for (si = stream->dep_next; si; si = si->sib_next) { check_queued(si); } } check_sum_dep(stream); check_dep_prev(stream); }
static void check_queued(nghttp2_stream *stream) { nghttp2_stream *si; int queued; if (stream->queued) { if (!stream_subtree_active(stream)) { fprintf(stderr, "stream(%p)=%d, stream->queued == 1, but " "stream_active() == %d and nghttp2_pq_size(&stream->obq) = %zu\n", stream, stream->stream_id, stream_active(stream), nghttp2_pq_size(&stream->obq)); assert(0); } if (!stream_active(stream)) { queued = 0; for (si = stream->dep_next; si; si = si->sib_next) { if (si->queued) { ++queued; } } if (queued == 0) { fprintf(stderr, "stream(%p)=%d, stream->queued == 1, and " "!stream_active(), but no descendants is queued\n", stream, stream->stream_id); assert(0); } } for (si = stream->dep_next; si; si = si->sib_next) { check_queued(si); } } else { if (stream_active(stream) || !nghttp2_pq_empty(&stream->obq)) { fprintf(stderr, "stream(%p) = %d, stream->queued == 0, but " "stream_active(stream) == %d and " "nghttp2_pq_size(&stream->obq) = %zu\n", stream, stream->stream_id, stream_active(stream), nghttp2_pq_size(&stream->obq)); assert(0); } for (si = stream->dep_next; si; si = si->sib_next) { ensure_inactive(si); } } }