Ensure that pri goes to the lowest value

This commit is contained in:
Tatsuhiro Tsujikawa 2013-12-07 16:14:39 +09:00
parent ffed4f0031
commit d773b42a2d
1 changed files with 5 additions and 1 deletions

View File

@ -1398,11 +1398,15 @@ nghttp2_outbound_item* nghttp2_session_pop_next_ob_item
*/ */
static void adjust_pri(nghttp2_outbound_item *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 = item->inipri;
item->pri_decay = 1; item->pri_decay = 1;
return; 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 += (int32_t)(item->pri_decay - 1);
item->pri_decay <<= 1; item->pri_decay <<= 1;
} }