mirror of
https://gitee.com/openharmony/third_party_nghttp2
synced 2024-11-24 08:20:20 +00:00
Lower priority by constant value
This commit is contained in:
parent
9d49f9a356
commit
e17f888944
@ -53,8 +53,6 @@ typedef struct {
|
||||
int32_t pri;
|
||||
/* The initial priority */
|
||||
int32_t inipri;
|
||||
/* The amount of priority decrement in next time */
|
||||
uint32_t pri_decay;
|
||||
} nghttp2_outbound_item;
|
||||
|
||||
/*
|
||||
|
@ -474,7 +474,6 @@ int nghttp2_session_add_frame(nghttp2_session *session,
|
||||
item->seq = session->next_seq++;
|
||||
/* Set priority to the default value at the moment. */
|
||||
item->pri = NGHTTP2_PRI_DEFAULT;
|
||||
item->pri_decay = 1;
|
||||
if(frame_cat == NGHTTP2_CAT_CTRL) {
|
||||
nghttp2_frame *frame = (nghttp2_frame*)abs_frame;
|
||||
nghttp2_stream *stream = NULL;
|
||||
@ -1390,25 +1389,24 @@ nghttp2_outbound_item* nghttp2_session_pop_next_ob_item
|
||||
}
|
||||
}
|
||||
|
||||
#define NGHTTP2_PRI_DECAY (1 << 26)
|
||||
/*
|
||||
* Adjust priority of the |item|. In order to prevent the low priority
|
||||
* streams from starving, lower the priority of the |item| by
|
||||
* item->pri_decay. If the resulting priority exceeds
|
||||
* streams from starving, lower the priority of the |item| by a
|
||||
* constant value. If the resulting priority exceeds
|
||||
* NGHTTP2_PRI_DEFAULT, back to the original priority.
|
||||
*/
|
||||
static void adjust_pri(nghttp2_outbound_item *item)
|
||||
{
|
||||
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))) {
|
||||
if(item->pri > (int32_t)(NGHTTP2_PRI_LOWEST - NGHTTP2_PRI_DECAY)) {
|
||||
item->pri = NGHTTP2_PRI_LOWEST;
|
||||
return;
|
||||
}
|
||||
item->pri += (int32_t)(item->pri_decay - 1);
|
||||
item->pri_decay <<= 1;
|
||||
item->pri += NGHTTP2_PRI_DECAY;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user