Interleave streams with the same priority

This commit is contained in:
Tatsuhiro Tsujikawa 2013-11-19 23:59:10 +09:00
parent e5e4fc9d14
commit bc21edf5b6
1 changed files with 4 additions and 1 deletions

View File

@ -1563,7 +1563,7 @@ static int nghttp2_session_after_frame_sent(nghttp2_session *session)
/* If priority of this stream is higher or equal to other stream /* If priority of this stream is higher or equal to other stream
waiting at the top of the queue, we continue to send this waiting at the top of the queue, we continue to send this
data. */ data. */
if(next_item == NULL || session->aob.item->pri <= next_item->pri) { if(next_item == NULL || session->aob.item->pri < next_item->pri) {
size_t next_readmax; size_t next_readmax;
nghttp2_stream *stream; nghttp2_stream *stream;
stream = nghttp2_session_get_stream(session, data_frame->hd.stream_id); stream = nghttp2_session_get_stream(session, data_frame->hd.stream_id);
@ -1607,6 +1607,9 @@ static int nghttp2_session_after_frame_sent(nghttp2_session *session)
session->aob.framebufoff = 0; session->aob.framebufoff = 0;
} }
} else { } else {
/* Update seq to interleave other streams with the same
priority. */
session->aob.item->seq = session->next_seq++;
r = nghttp2_pq_push(&session->ob_pq, session->aob.item); r = nghttp2_pq_push(&session->ob_pq, session->aob.item);
if(r == 0) { if(r == 0) {
session->aob.item = NULL; session->aob.item = NULL;