From 85671a69bf6b47d134fff3653f6f0638dbbff718 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 18 Apr 2015 16:47:46 +0900 Subject: [PATCH] Update doc --- lib/nghttp2_hd.h | 1 + lib/nghttp2_session.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/lib/nghttp2_hd.h b/lib/nghttp2_hd.h index 2d53d57a..4b76d1ce 100644 --- a/lib/nghttp2_hd.h +++ b/lib/nghttp2_hd.h @@ -51,6 +51,7 @@ /* Exported for unit test */ #define NGHTTP2_STATIC_TABLE_LENGTH 61 +/* Generated by genlibtokenlookup.py */ typedef enum { NGHTTP2_TOKEN__AUTHORITY = 0, NGHTTP2_TOKEN__METHOD = 1, diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index 3d5a25a2..108a30c1 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -2244,12 +2244,17 @@ static int session_close_stream_on_goaway(nghttp2_session *session, static void session_outbound_item_schedule(nghttp2_session *session, nghttp2_outbound_item *item, int32_t weight) { + /* Schedule next write. Offset proportional to the write size. + Stream with heavier weight is scheduled earlier. */ size_t delta = item->frame.hd.length * NGHTTP2_MAX_WEIGHT / weight; if (session->last_cycle < item->cycle) { session->last_cycle = item->cycle; } + /* We pretend to ignore overflow given that the value range of + item->cycle, which is uint64_t. nghttp2 won't explode even when + overflow occurs, there might be some disturbance of priority. */ item->cycle = session->last_cycle + delta; }