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
d54cfb88
Commit
d54cfb88
authored
Jul 16, 2013
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add connection-level flow control
parent
3ed5c78a
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
173 additions
and
34 deletions
+173
-34
lib/nghttp2_session.c
lib/nghttp2_session.c
+140
-28
tests/nghttp2_session_test.c
tests/nghttp2_session_test.c
+33
-6
No files found.
lib/nghttp2_session.c
View file @
d54cfb88
This diff is collapsed.
Click to expand it.
tests/nghttp2_session_test.c
View file @
d54cfb88
...
@@ -1894,11 +1894,19 @@ void test_nghttp2_session_flow_control(void)
...
@@ -1894,11 +1894,19 @@ void test_nghttp2_session_flow_control(void)
CU_ASSERT
(
0
==
nghttp2_session_send
(
session
));
CU_ASSERT
(
0
==
nghttp2_session_send
(
session
));
CU_ASSERT
(
64
*
1024
==
ud
.
data_source_length
);
CU_ASSERT
(
64
*
1024
==
ud
.
data_source_length
);
/* Back 32KiB */
/* Back 32KiB
in stream window
*/
nghttp2_frame_window_update_init
(
&
frame
.
window_update
,
NGHTTP2_FLAG_NONE
,
nghttp2_frame_window_update_init
(
&
frame
.
window_update
,
NGHTTP2_FLAG_NONE
,
1
,
32
*
1024
);
1
,
32
*
1024
);
nghttp2_session_on_window_update_received
(
session
,
&
frame
);
nghttp2_session_on_window_update_received
(
session
,
&
frame
);
/* Send nothing because of connection-level window */
CU_ASSERT
(
0
==
nghttp2_session_send
(
session
));
CU_ASSERT
(
64
*
1024
==
ud
.
data_source_length
);
/* Back 32KiB in connection-level window */
frame
.
hd
.
stream_id
=
0
;
nghttp2_session_on_window_update_received
(
session
,
&
frame
);
/* Sends another 32KiB data */
/* Sends another 32KiB data */
CU_ASSERT
(
0
==
nghttp2_session_send
(
session
));
CU_ASSERT
(
0
==
nghttp2_session_send
(
session
));
CU_ASSERT
(
32
*
1024
==
ud
.
data_source_length
);
CU_ASSERT
(
32
*
1024
==
ud
.
data_source_length
);
...
@@ -1914,18 +1922,26 @@ void test_nghttp2_session_flow_control(void)
...
@@ -1914,18 +1922,26 @@ void test_nghttp2_session_flow_control(void)
new_initial_window_size
;
new_initial_window_size
;
CU_ASSERT
(
-
48
*
1024
==
stream
->
window_size
);
CU_ASSERT
(
-
48
*
1024
==
stream
->
window_size
);
/* Back 48KiB */
/* Back 48KiB to stream window */
frame
.
hd
.
stream_id
=
1
;
frame
.
window_update
.
window_size_increment
=
48
*
1024
;
frame
.
window_update
.
window_size_increment
=
48
*
1024
;
nghttp2_session_on_window_update_received
(
session
,
&
frame
);
nghttp2_session_on_window_update_received
(
session
,
&
frame
);
/* Nothing is sent because window_size is
less than
0 */
/* Nothing is sent because window_size is 0 */
CU_ASSERT
(
0
==
nghttp2_session_send
(
session
));
CU_ASSERT
(
0
==
nghttp2_session_send
(
session
));
CU_ASSERT
(
32
*
1024
==
ud
.
data_source_length
);
CU_ASSERT
(
32
*
1024
==
ud
.
data_source_length
);
/* Back 16KiB */
/* Back 16KiB in stream window */
frame
.
hd
.
stream_id
=
1
;
frame
.
window_update
.
window_size_increment
=
16
*
1024
;
frame
.
window_update
.
window_size_increment
=
16
*
1024
;
nghttp2_session_on_window_update_received
(
session
,
&
frame
);
nghttp2_session_on_window_update_received
(
session
,
&
frame
);
/* Back 24KiB in connection-level window */
frame
.
hd
.
stream_id
=
0
;
frame
.
window_update
.
window_size_increment
=
24
*
1024
;
nghttp2_session_on_window_update_received
(
session
,
&
frame
);
/* Sends another 16KiB data */
/* Sends another 16KiB data */
CU_ASSERT
(
0
==
nghttp2_session_send
(
session
));
CU_ASSERT
(
0
==
nghttp2_session_send
(
session
));
CU_ASSERT
(
16
*
1024
==
ud
.
data_source_length
);
CU_ASSERT
(
16
*
1024
==
ud
.
data_source_length
);
...
@@ -1938,7 +1954,16 @@ void test_nghttp2_session_flow_control(void)
...
@@ -1938,7 +1954,16 @@ void test_nghttp2_session_flow_control(void)
nghttp2_session_on_settings_received
(
session
,
&
settings_frame
);
nghttp2_session_on_settings_received
(
session
,
&
settings_frame
);
nghttp2_frame_settings_free
(
&
settings_frame
.
settings
);
nghttp2_frame_settings_free
(
&
settings_frame
.
settings
);
/* Sends another 16KiB data */
/* Sends another 8KiB data */
CU_ASSERT
(
0
==
nghttp2_session_send
(
session
));
CU_ASSERT
(
8
*
1024
==
ud
.
data_source_length
);
/* Back 8KiB in connection-level window */
frame
.
hd
.
stream_id
=
0
;
frame
.
window_update
.
window_size_increment
=
8
*
1024
;
nghttp2_session_on_window_update_received
(
session
,
&
frame
);
/* Sends last 8KiB data */
CU_ASSERT
(
0
==
nghttp2_session_send
(
session
));
CU_ASSERT
(
0
==
nghttp2_session_send
(
session
));
CU_ASSERT
(
0
==
ud
.
data_source_length
);
CU_ASSERT
(
0
==
ud
.
data_source_length
);
CU_ASSERT
(
nghttp2_session_get_stream
(
session
,
1
)
->
shut_flags
&
CU_ASSERT
(
nghttp2_session_get_stream
(
session
,
1
)
->
shut_flags
&
...
@@ -1981,10 +2006,12 @@ void test_nghttp2_session_data_read_temporal_failure(void)
...
@@ -1981,10 +2006,12 @@ void test_nghttp2_session_data_read_temporal_failure(void)
data_frame
->
data_prd
.
read_callback
=
data_frame
->
data_prd
.
read_callback
=
temporal_failure_data_source_read_callback
;
temporal_failure_data_source_read_callback
;
/* Back 64KiB */
/* Back 64KiB
to both connection-level and stream-wise window
*/
nghttp2_frame_window_update_init
(
&
frame
.
window_update
,
NGHTTP2_FLAG_NONE
,
nghttp2_frame_window_update_init
(
&
frame
.
window_update
,
NGHTTP2_FLAG_NONE
,
1
,
64
*
1024
);
1
,
64
*
1024
);
nghttp2_session_on_window_update_received
(
session
,
&
frame
);
nghttp2_session_on_window_update_received
(
session
,
&
frame
);
frame
.
hd
.
stream_id
=
0
;
nghttp2_session_on_window_update_received
(
session
,
&
frame
);
nghttp2_frame_window_update_free
(
&
frame
.
window_update
);
nghttp2_frame_window_update_free
(
&
frame
.
window_update
);
/* Sending data will fail (soft fail) and treated as stream error */
/* Sending data will fail (soft fail) and treated as stream error */
...
...
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