diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index 411fa7ab..da678409 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -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; } diff --git a/tests/nghttp2_session_test.c b/tests/nghttp2_session_test.c index 149dd81b..32e27a0b 100644 --- a/tests/nghttp2_session_test.c +++ b/tests/nghttp2_session_test.c @@ -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);