From 0dec04921d929c1e36c85983d0d6481ace307f6a Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 9 Aug 2013 21:21:14 +0900 Subject: [PATCH] Remove priority adjustment for a DATA frame Simply it does not work as expected. --- lib/nghttp2_outbound_item.h | 16 ---------------- lib/nghttp2_session.c | 25 ------------------------- 2 files changed, 41 deletions(-) diff --git a/lib/nghttp2_outbound_item.h b/lib/nghttp2_outbound_item.h index 55597b85..24929efb 100644 --- a/lib/nghttp2_outbound_item.h +++ b/lib/nghttp2_outbound_item.h @@ -34,10 +34,6 @@ /* Priority for PING */ #define NGHTTP2_OB_PRI_PING -10 -/* Priority for CREDENTIAL */ -#define NGHTTP2_OB_PRI_CREDENTIAL -2 -/* Priority for the frame which must be sent after CREDENTIAL */ -#define NGHTTP2_OB_PRI_AFTER_CREDENTIAL -1 typedef struct { nghttp2_data_provider *data_prd; @@ -50,19 +46,7 @@ typedef struct { nghttp2_frame_category frame_cat; void *frame; void *aux_data; - /* Initial priority of this item */ - int inipri; - /* The current priority of this item. Initially, pri equals to - inipri. The item is chosen from the queue based on pri and - seq. For control frames, they consist of just 1 frame and pri - does not change. For DATA frame, they could split up to several - frames. After sending a frame, the pri becomes |inipri| + - |pridecay| and |pridecay| is multiplied by 2. If it becomes more - than lowest priority, then it returns back to |inipri| and do the - same sequence again and again. By doing this, the higher priority - long DATA frames don't starve the lower prioritized streams. */ int pri; - uint32_t pridecay; int64_t seq; } nghttp2_outbound_item; diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index a50a2fd9..3bed0fe9 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -415,8 +415,6 @@ int nghttp2_session_add_frame(nghttp2_session *session, free(item); return r; } - item->inipri = item->pri; - item->pridecay = 1; return 0; } @@ -1193,28 +1191,6 @@ nghttp2_outbound_item* nghttp2_session_pop_next_ob_item } } -/* - * Adjust priority of item so that the higher priority long DATA - * frames don't starve lower priority streams. - */ -static void nghttp2_outbound_item_adjust_pri(nghttp2_session *session, - nghttp2_outbound_item *item) -{ - if(item->pri == NGHTTP2_PRI_LOWEST) { - nghttp2_stream *stream; - stream = nghttp2_session_get_stream - (session, nghttp2_outbound_item_get_data_frame(item)->hd.stream_id); - assert(stream); - item->pri = item->inipri = stream->pri; - item->pridecay = 1; - } else if(item->pri + item->pridecay > NGHTTP2_PRI_LOWEST) { - item->pri = NGHTTP2_PRI_LOWEST; - } else { - item->pri = item->inipri + item->pridecay; - item->pridecay *= 2; - } -} - /* * Called after a frame is sent. * @@ -1368,7 +1344,6 @@ static int nghttp2_session_after_frame_sent(nghttp2_session *session) } else { nghttp2_outbound_item* next_item; next_item = nghttp2_session_get_next_ob_item(session); - nghttp2_outbound_item_adjust_pri(session, session->aob.item); /* If priority of this stream is higher or equal to other stream waiting at the top of the queue, we continue to send this data. */