Reset cycle to 0 if stream has only 1 direct descendant

This commit is contained in:
Tatsuhiro Tsujikawa 2015-08-29 23:43:54 +09:00
parent e6566a1e3a
commit 4cad48da16
1 changed files with 12 additions and 7 deletions

View File

@ -201,18 +201,23 @@ void nghttp2_stream_reschedule(nghttp2_stream *stream) {
dep_stream = stream->dep_prev; dep_stream = stream->dep_prev;
for (; dep_stream; stream = dep_stream, dep_stream = dep_stream->dep_prev) { for (; dep_stream; stream = dep_stream, dep_stream = dep_stream->dep_prev) {
dep_stream->descendant_last_cycle = if (nghttp2_pq_size(&dep_stream->obq) == 1) {
nghttp2_max(dep_stream->descendant_last_cycle, stream->cycle); dep_stream->descendant_last_cycle = 0;
stream->cycle = 0;
} else {
dep_stream->descendant_last_cycle =
nghttp2_max(dep_stream->descendant_last_cycle, stream->cycle);
stream->cycle = stream->cycle =
stream_next_cycle(stream, dep_stream->descendant_last_cycle); stream_next_cycle(stream, dep_stream->descendant_last_cycle);
nghttp2_pq_remove(&dep_stream->obq, &stream->pq_entry);
nghttp2_pq_push(&dep_stream->obq, &stream->pq_entry);
}
DEBUGF(fprintf(stderr, "stream: stream=%d obq resched cycle=%ld\n", DEBUGF(fprintf(stderr, "stream: stream=%d obq resched cycle=%ld\n",
stream->stream_id, stream->cycle)); stream->stream_id, stream->cycle));
nghttp2_pq_remove(&dep_stream->obq, &stream->pq_entry);
nghttp2_pq_push(&dep_stream->obq, &stream->pq_entry);
dep_stream->last_writelen = stream->last_writelen; dep_stream->last_writelen = stream->last_writelen;
} }
} }