Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
e17f8889
Commit
e17f8889
authored
Dec 11, 2013
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Lower priority by constant value
parent
9d49f9a3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
9 deletions
+5
-9
lib/nghttp2_outbound_item.h
lib/nghttp2_outbound_item.h
+0
-2
lib/nghttp2_session.c
lib/nghttp2_session.c
+5
-7
No files found.
lib/nghttp2_outbound_item.h
View file @
e17f8889
...
...
@@ -53,8 +53,6 @@ typedef struct {
int32_t
pri
;
/* The initial priority */
int32_t
inipri
;
/* The amount of priority decrement in next time */
uint32_t
pri_decay
;
}
nghttp2_outbound_item
;
/*
...
...
lib/nghttp2_session.c
View file @
e17f8889
...
...
@@ -474,7 +474,6 @@ int nghttp2_session_add_frame(nghttp2_session *session,
item
->
seq
=
session
->
next_seq
++
;
/* Set priority to the default value at the moment. */
item
->
pri
=
NGHTTP2_PRI_DEFAULT
;
item
->
pri_decay
=
1
;
if
(
frame_cat
==
NGHTTP2_CAT_CTRL
)
{
nghttp2_frame
*
frame
=
(
nghttp2_frame
*
)
abs_frame
;
nghttp2_stream
*
stream
=
NULL
;
...
...
@@ -1390,25 +1389,24 @@ nghttp2_outbound_item* nghttp2_session_pop_next_ob_item
}
}
#define NGHTTP2_PRI_DECAY (1 << 26)
/*
* Adjust priority of the |item|. In order to prevent the low priority
* streams from starving, lower the priority of the |item| by
*
item->pri_decay
. If the resulting priority exceeds
* streams from starving, lower the priority of the |item| by
a
*
constant value
. If the resulting priority exceeds
* NGHTTP2_PRI_DEFAULT, back to the original priority.
*/
static
void
adjust_pri
(
nghttp2_outbound_item
*
item
)
{
if
(
item
->
pri
==
NGHTTP2_PRI_LOWEST
)
{
item
->
pri
=
item
->
inipri
;
item
->
pri_decay
=
1
;
return
;
}
if
(
item
->
pri
>
(
int32_t
)(
NGHTTP2_PRI_LOWEST
-
(
item
->
pri_decay
-
1
)
))
{
if
(
item
->
pri
>
(
int32_t
)(
NGHTTP2_PRI_LOWEST
-
NGHTTP2_PRI_DECAY
))
{
item
->
pri
=
NGHTTP2_PRI_LOWEST
;
return
;
}
item
->
pri
+=
(
int32_t
)(
item
->
pri_decay
-
1
);
item
->
pri_decay
<<=
1
;
item
->
pri
+=
NGHTTP2_PRI_DECAY
;
}
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment