Last active
December 17, 2015 17:08
-
-
Save tatsuhiro-t/5643313 to your computer and use it in GitHub Desktop.
2nd patch for spdylay issue69, to give lower priority streams more chance to deliver output.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/spdylay_outbound_item.h b/lib/spdylay_outbound_item.h | |
index 12db6a6..21ebef9 100644 | |
--- a/lib/spdylay_outbound_item.h | |
+++ b/lib/spdylay_outbound_item.h | |
@@ -50,6 +50,7 @@ typedef struct { | |
spdylay_frame_category frame_cat; | |
void *frame; | |
void *aux_data; | |
+ int inipri; | |
int pri; | |
int64_t seq; | |
} spdylay_outbound_item; | |
diff --git a/lib/spdylay_session.c b/lib/spdylay_session.c | |
index f4d6961..2fed907 100644 | |
--- a/lib/spdylay_session.c | |
+++ b/lib/spdylay_session.c | |
@@ -444,6 +444,7 @@ int spdylay_session_add_frame(spdylay_session *session, | |
free(item); | |
return r; | |
} | |
+ item->inipri = item->pri; | |
return 0; | |
} | |
@@ -1246,6 +1247,16 @@ spdylay_outbound_item* spdylay_session_pop_next_ob_item | |
} | |
} | |
+static void spdylay_outbound_item_adjust_pri(spdylay_session *session, | |
+ spdylay_outbound_item *item) | |
+{ | |
+ if(item->pri > spdylay_session_get_pri_lowest(session)) { | |
+ item->pri = item->inipri; | |
+ } else { | |
+ ++item->pri; | |
+ } | |
+} | |
+ | |
/* | |
* Called after a frame is sent. | |
* | |
@@ -1400,6 +1411,7 @@ static int spdylay_session_after_frame_sent(spdylay_session *session) | |
} else { | |
spdylay_outbound_item* next_item; | |
next_item = spdylay_session_get_next_ob_item(session); | |
+ spdylay_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. */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment