Commit 1a12a9b3 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

Penalize cycle according to effective weight

parent 57644e02
......@@ -2246,9 +2246,10 @@ static void session_outbound_item_schedule(nghttp2_session *session,
int32_t weight) {
size_t delta = item->frame.hd.length * NGHTTP2_MAX_WEIGHT / weight;
assert(session->last_cycle <= item->cycle);
if (session->last_cycle < item->cycle) {
session->last_cycle = item->cycle;
}
session->last_cycle = item->cycle;
item->cycle = session->last_cycle + delta;
}
......
......@@ -101,7 +101,12 @@ static int stream_push_item(nghttp2_stream *stream, nghttp2_session *session) {
return 0;
}
item->cycle = session->last_cycle;
/* Penalize item by delaying scheduling according to effective
weight. This will delay low priority stream, which is good.
OTOH, this may incur delay for high priority item. Will see. */
item->cycle =
session->last_cycle +
NGHTTP2_DATA_PAYLOADLEN * NGHTTP2_MAX_WEIGHT / stream->effective_weight;
switch (item->frame.hd.type) {
case NGHTTP2_DATA:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment