Limit the number of streams in one dependency tree
This commit is contained in:
parent
f7162ab702
commit
36c8de9da5
|
@ -463,6 +463,7 @@ int nghttp2_session_reprioritize_stream
|
||||||
nghttp2_stream_group *stream_group;
|
nghttp2_stream_group *stream_group;
|
||||||
nghttp2_stream_group *old_stream_group;
|
nghttp2_stream_group *old_stream_group;
|
||||||
nghttp2_stream *dep_stream;
|
nghttp2_stream *dep_stream;
|
||||||
|
nghttp2_stream *root_stream;
|
||||||
const nghttp2_priority_group *group;
|
const nghttp2_priority_group *group;
|
||||||
const nghttp2_priority_dep *dep;
|
const nghttp2_priority_dep *dep;
|
||||||
|
|
||||||
|
@ -529,11 +530,20 @@ int nghttp2_session_reprioritize_stream
|
||||||
|
|
||||||
nghttp2_stream_dep_remove_subtree(stream);
|
nghttp2_stream_dep_remove_subtree(stream);
|
||||||
|
|
||||||
|
root_stream = nghttp2_stream_get_dep_root(dep_stream);
|
||||||
|
|
||||||
|
if(root_stream->num_substreams + stream->num_substreams >
|
||||||
|
NGHTTP2_MAX_DEP_TREE_LENGTH) {
|
||||||
|
rv = nghttp2_stream_dep_make_root(dep_stream->stream_group, stream,
|
||||||
|
&session->ob_pq);
|
||||||
|
} else {
|
||||||
if(dep->exclusive) {
|
if(dep->exclusive) {
|
||||||
rv = nghttp2_stream_dep_insert_subtree(dep_stream, stream,
|
rv = nghttp2_stream_dep_insert_subtree(dep_stream, stream,
|
||||||
&session->ob_pq);
|
&session->ob_pq);
|
||||||
} else {
|
} else {
|
||||||
rv = nghttp2_stream_dep_add_subtree(dep_stream, stream, &session->ob_pq);
|
rv = nghttp2_stream_dep_add_subtree(dep_stream, stream,
|
||||||
|
&session->ob_pq);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(rv != 0) {
|
if(rv != 0) {
|
||||||
|
@ -719,6 +729,7 @@ nghttp2_stream* nghttp2_session_open_stream(nghttp2_session *session,
|
||||||
int rv;
|
int rv;
|
||||||
nghttp2_stream *stream;
|
nghttp2_stream *stream;
|
||||||
nghttp2_stream *dep_stream;
|
nghttp2_stream *dep_stream;
|
||||||
|
nghttp2_stream *root_stream;
|
||||||
int32_t pri_group_id;
|
int32_t pri_group_id;
|
||||||
uint8_t weight;
|
uint8_t weight;
|
||||||
nghttp2_stream_group *stream_group;
|
nghttp2_stream_group *stream_group;
|
||||||
|
@ -809,11 +820,15 @@ nghttp2_stream* nghttp2_session_open_stream(nghttp2_session *session,
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
root_stream = nghttp2_stream_get_dep_root(dep_stream);
|
||||||
|
|
||||||
|
if(root_stream->num_substreams < NGHTTP2_MAX_DEP_TREE_LENGTH) {
|
||||||
if(pri_spec->dep.exclusive) {
|
if(pri_spec->dep.exclusive) {
|
||||||
nghttp2_stream_dep_insert(dep_stream, stream);
|
nghttp2_stream_dep_insert(dep_stream, stream);
|
||||||
} else {
|
} else {
|
||||||
nghttp2_stream_dep_add(dep_stream, stream);
|
nghttp2_stream_dep_add(dep_stream, stream);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,11 @@
|
||||||
#include "nghttp2_pq.h"
|
#include "nghttp2_pq.h"
|
||||||
#include "nghttp2_int.h"
|
#include "nghttp2_int.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Maximum number of streams in one dependency tree.
|
||||||
|
*/
|
||||||
|
#define NGHTTP2_MAX_DEP_TREE_LENGTH 100
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If local peer is stream initiator:
|
* If local peer is stream initiator:
|
||||||
* NGHTTP2_STREAM_OPENING : upon sending request HEADERS
|
* NGHTTP2_STREAM_OPENING : upon sending request HEADERS
|
||||||
|
|
Loading…
Reference in New Issue