From d773b42a2d5b0500588e26998cd446c0f423b13d Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 7 Dec 2013 16:14:39 +0900 Subject: [PATCH] Ensure that pri goes to the lowest value --- lib/nghttp2_session.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index 46829138..8273dc98 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -1398,11 +1398,15 @@ nghttp2_outbound_item* nghttp2_session_pop_next_ob_item */ static void adjust_pri(nghttp2_outbound_item *item) { - if(item->pri >= (int32_t)(NGHTTP2_PRI_LOWEST - (item->pri_decay - 1))) { + if(item->pri == NGHTTP2_PRI_LOWEST) { item->pri = item->inipri; item->pri_decay = 1; return; } + if(item->pri > (int32_t)(NGHTTP2_PRI_LOWEST - (item->pri_decay - 1))) { + item->pri = NGHTTP2_PRI_LOWEST; + return; + } item->pri += (int32_t)(item->pri_decay - 1); item->pri_decay <<= 1; }