Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
61b594af
Commit
61b594af
authored
Sep 25, 2018
by
gejun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Separate window_size of connections from streams and fix WU bugs
parent
8994b65a
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
8 deletions
+43
-8
http2.cpp
src/brpc/http2.cpp
+25
-3
http2.h
src/brpc/http2.h
+12
-4
http2_rpc_protocol.cpp
src/brpc/policy/http2_rpc_protocol.cpp
+0
-0
server.cpp
src/brpc/server.cpp
+5
-0
server.h
src/brpc/server.h
+1
-1
No files found.
src/brpc/http2.cpp
View file @
61b594af
...
...
@@ -23,17 +23,39 @@ H2Settings::H2Settings()
:
header_table_size
(
DEFAULT_HEADER_TABLE_SIZE
)
,
enable_push
(
false
)
,
max_concurrent_streams
(
std
::
numeric_limits
<
uint32_t
>::
max
())
,
initial_window_size
(
DEFAULT_INITIAL_WINDOW_SIZE
)
,
stream_window_size
(
256
*
1024
)
,
connection_window_size
(
1024
*
1024
)
,
max_frame_size
(
DEFAULT_MAX_FRAME_SIZE
)
,
max_header_list_size
(
std
::
numeric_limits
<
uint32_t
>::
max
())
{
}
bool
H2Settings
::
IsValid
(
bool
log_error
)
const
{
if
(
stream_window_size
>
MAX_WINDOW_SIZE
)
{
LOG_IF
(
ERROR
,
log_error
)
<<
"Invalid stream_window_size="
<<
stream_window_size
;
return
false
;
}
if
(
connection_window_size
<
DEFAULT_INITIAL_WINDOW_SIZE
||
connection_window_size
>
MAX_WINDOW_SIZE
)
{
LOG_IF
(
ERROR
,
log_error
)
<<
"Invalid connection_window_size="
<<
connection_window_size
;
return
false
;
}
if
(
max_frame_size
<
DEFAULT_MAX_FRAME_SIZE
||
max_frame_size
>
MAX_OF_MAX_FRAME_SIZE
)
{
LOG_IF
(
ERROR
,
log_error
)
<<
"Invalid max_frame_size="
<<
max_frame_size
;
return
false
;
}
return
true
;
}
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
H2Settings
&
s
)
{
os
<<
"{header_table_size="
<<
s
.
header_table_size
<<
" enable_push="
<<
s
.
enable_push
<<
" max_concurrent_streams="
<<
s
.
max_concurrent_streams
<<
" initial_window_size="
<<
s
.
initial_window_size
<<
" max_frame_size="
<<
s
.
max_frame_size
<<
" stream_window_size="
<<
s
.
stream_window_size
;
if
(
s
.
connection_window_size
>
0
)
{
os
<<
" conn_window_size="
<<
s
.
connection_window_size
;
}
os
<<
" max_frame_size="
<<
s
.
max_frame_size
<<
" max_header_list_size="
<<
s
.
max_header_list_size
<<
'}'
;
return
os
;
...
...
src/brpc/http2.h
View file @
61b594af
...
...
@@ -26,6 +26,9 @@ struct H2Settings {
// Construct with default values.
H2Settings
();
// Returns true iff all options are valid.
bool
IsValid
(
bool
log_error
=
false
)
const
;
// Allows the sender to inform the remote endpoint of the maximum size of
// the header compression table used to decode header blocks, in octets.
// The encoder can select any size equal to or less than this value by
...
...
@@ -41,7 +44,7 @@ struct H2Settings {
// parameter to 0 and had it acknowledged MUST treat the receipt of a
// PUSH_PROMISE frame as a connection error (Section 5.4.1) of type
// PROTOCOL_ERROR.
// Default:
true (server push is permitt
ed)
// Default:
false (server push is disabl
ed)
static
const
bool
DEFAULT_ENABLE_PUSH
=
true
;
bool
enable_push
;
...
...
@@ -60,10 +63,15 @@ struct H2Settings {
// This setting affects the window size of all streams (see Section 6.9.2).
// Values above the maximum flow-control window size of 2^31-1 are treated
// as a connection error (Section 5.4.1) of type FLOW_CONTROL_ERROR
// Default:
65535
// Default:
256 * 1024
static
const
uint32_t
DEFAULT_INITIAL_WINDOW_SIZE
=
65535
;
static
const
uint32_t
MAX_INITIAL_WINDOW_SIZE
=
(
1u
<<
31
)
-
1
;
uint32_t
initial_window_size
;
static
const
uint32_t
MAX_WINDOW_SIZE
=
(
1u
<<
31
)
-
1
;
uint32_t
stream_window_size
;
// Initial window size for connection-level flow control.
// Default: 1024 * 1024
// Setting to zero stops printing this field.
uint32_t
connection_window_size
;
// Size of the largest frame payload that the sender is willing to receive,
// in octets. The value advertised by an endpoint MUST be between 16384 and
...
...
src/brpc/policy/http2_rpc_protocol.cpp
View file @
61b594af
This diff is collapsed.
Click to expand it.
src/brpc/server.cpp
View file @
61b594af
...
...
@@ -725,6 +725,11 @@ int Server::StartInternal(const butil::ip_t& ip,
_options
=
ServerOptions
();
}
if
(
!
_options
.
h2_settings
.
IsValid
(
true
/*log_error*/
))
{
LOG
(
ERROR
)
<<
"Invalid h2_settings"
;
return
-
1
;
}
if
(
_options
.
http_master_service
)
{
// Check requirements for http_master_service:
// has "default_method" & request/response have no fields
...
...
src/brpc/server.h
View file @
61b594af
...
...
@@ -231,7 +231,7 @@ struct ServerOptions {
std
::
string
enabled_protocols
;
// Customize parameters of HTTP2, defined in http2.h
H2Settings
h
ttp2_settings
;
H2Settings
h
2_settings
;
private
:
// SSLOptions is large and not often used, allocate it on heap to
...
...
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