Fix bug that dep_stream->sum_dep_weight was not updated

This commit is contained in:
Tatsuhiro Tsujikawa 2015-11-20 21:24:54 +09:00
parent 4db3828fa6
commit d7b0768ab8
2 changed files with 10 additions and 0 deletions

View File

@ -661,6 +661,7 @@ int nghttp2_session_reprioritize_stream(
}
if (dep_stream == stream->dep_prev && !pri_spec->exclusive) {
dep_stream->sum_dep_weight += pri_spec->weight - stream->weight;
stream->weight = pri_spec->weight;
return 0;
}

View File

@ -3447,6 +3447,15 @@ void test_nghttp2_session_reprioritize_stream(void) {
CU_ASSERT(128 == stream->weight);
CU_ASSERT(dep_stream == stream->dep_prev);
/* Change weight again to test short-path case */
pri_spec.weight = 100;
nghttp2_session_reprioritize_stream(session, stream, &pri_spec);
CU_ASSERT(100 == stream->weight);
CU_ASSERT(dep_stream == stream->dep_prev);
CU_ASSERT(100 == dep_stream->sum_dep_weight);
/* Test circular dependency; stream 1 is first removed and becomes
root. Then stream 3 depends on it. */
nghttp2_priority_spec_init(&pri_spec, 1, 1, 0);