Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
2a2a6ed1
Commit
2a2a6ed1
authored
9 years ago
by
Craig Tiller
Browse files
Options
Downloads
Patches
Plain Diff
Support rebuilding table
parent
b1136495
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/grpc/grpc.h
+1
-0
1 addition, 0 deletions
include/grpc/grpc.h
src/core/transport/chttp2/hpack_encoder.c
+16
-2
16 additions, 2 deletions
src/core/transport/chttp2/hpack_encoder.c
tools/run_tests/run_tests.py
+2
-2
2 additions, 2 deletions
tools/run_tests/run_tests.py
with
19 additions
and
4 deletions
include/grpc/grpc.h
+
1
−
0
View file @
2a2a6ed1
...
@@ -130,6 +130,7 @@ typedef struct {
...
@@ -130,6 +130,7 @@ typedef struct {
/** How much memory to use for hpack decoding */
/** How much memory to use for hpack decoding */
#define GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_DECODER \
#define GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_DECODER \
"grpc.http2.hpack_table_size.decoder"
"grpc.http2.hpack_table_size.decoder"
/** How much memory to use for hpack encoding */
#define GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_ENCODER \
#define GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_ENCODER \
"grpc.http2.hpack_table_size.encoder"
"grpc.http2.hpack_table_size.encoder"
/** Default authority to pass if none specified on call construction */
/** Default authority to pass if none specified on call construction */
...
...
This diff is collapsed.
Click to expand it.
src/core/transport/chttp2/hpack_encoder.c
+
16
−
2
View file @
2a2a6ed1
...
@@ -474,7 +474,8 @@ void grpc_chttp2_hpack_compressor_init(grpc_chttp2_hpack_compressor *c,
...
@@ -474,7 +474,8 @@ void grpc_chttp2_hpack_compressor_init(grpc_chttp2_hpack_compressor *c,
c
->
mdctx
=
ctx
;
c
->
mdctx
=
ctx
;
c
->
timeout_key_str
=
grpc_mdstr_from_string
(
ctx
,
"grpc-timeout"
);
c
->
timeout_key_str
=
grpc_mdstr_from_string
(
ctx
,
"grpc-timeout"
);
c
->
max_table_size
=
GRPC_CHTTP2_HPACKC_INITIAL_TABLE_SIZE
;
c
->
max_table_size
=
GRPC_CHTTP2_HPACKC_INITIAL_TABLE_SIZE
;
c
->
cap_table_elems
=
c
->
max_table_elems
=
elems_for_bytes
(
c
->
max_table_size
);
c
->
cap_table_elems
=
elems_for_bytes
(
c
->
max_table_size
);
c
->
max_table_elems
=
c
->
cap_table_elems
;
c
->
max_usable_size
=
GRPC_CHTTP2_HPACKC_INITIAL_TABLE_SIZE
;
c
->
max_usable_size
=
GRPC_CHTTP2_HPACKC_INITIAL_TABLE_SIZE
;
c
->
table_elem_size
=
c
->
table_elem_size
=
gpr_malloc
(
sizeof
(
*
c
->
table_elem_size
)
*
c
->
cap_table_elems
);
gpr_malloc
(
sizeof
(
*
c
->
table_elem_size
)
*
c
->
cap_table_elems
);
...
@@ -500,7 +501,20 @@ void grpc_chttp2_hpack_compressor_set_max_usable_size(
...
@@ -500,7 +501,20 @@ void grpc_chttp2_hpack_compressor_set_max_usable_size(
}
}
static
void
rebuild_elems
(
grpc_chttp2_hpack_compressor
*
c
,
gpr_uint32
new_cap
)
{
static
void
rebuild_elems
(
grpc_chttp2_hpack_compressor
*
c
,
gpr_uint32
new_cap
)
{
gpr_uint16
*
table_elem_size
=
gpr_malloc
(
sizeof
(
*
table_elem_size
)
*
new_cap
);
gpr_uint32
i
;
memset
(
table_elem_size
,
0
,
sizeof
(
*
table_elem_size
)
*
new_cap
);
GPR_ASSERT
(
c
->
table_elems
<=
new_cap
);
for
(
i
=
0
;
i
<
c
->
table_elems
;
i
++
)
{
gpr_uint32
ofs
=
c
->
tail_remote_index
+
i
+
1
;
table_elem_size
[
ofs
%
new_cap
]
=
c
->
table_elem_size
[
ofs
%
c
->
cap_table_elems
];
}
c
->
cap_table_elems
=
new_cap
;
gpr_free
(
c
->
table_elem_size
);
c
->
table_elem_size
=
table_elem_size
;
}
}
void
grpc_chttp2_hpack_compressor_set_max_table_size
(
void
grpc_chttp2_hpack_compressor_set_max_table_size
(
...
@@ -517,7 +531,7 @@ void grpc_chttp2_hpack_compressor_set_max_table_size(
...
@@ -517,7 +531,7 @@ void grpc_chttp2_hpack_compressor_set_max_table_size(
if
(
c
->
max_table_elems
>
c
->
cap_table_elems
)
{
if
(
c
->
max_table_elems
>
c
->
cap_table_elems
)
{
rebuild_elems
(
c
,
GPR_MAX
(
c
->
max_table_elems
,
2
*
c
->
cap_table_elems
));
rebuild_elems
(
c
,
GPR_MAX
(
c
->
max_table_elems
,
2
*
c
->
cap_table_elems
));
}
else
if
(
c
->
max_table_elems
<
c
->
cap_table_elems
/
3
)
{
}
else
if
(
c
->
max_table_elems
<
c
->
cap_table_elems
/
3
)
{
gpr_uint32
new_cap
=
GPR_M
IN
(
c
->
max_table_elems
,
16
);
gpr_uint32
new_cap
=
GPR_M
AX
(
c
->
max_table_elems
,
16
);
if
(
new_cap
!=
c
->
cap_table_elems
)
{
if
(
new_cap
!=
c
->
cap_table_elems
)
{
rebuild_elems
(
c
,
new_cap
);
rebuild_elems
(
c
,
new_cap
);
}
}
...
...
This diff is collapsed.
Click to expand it.
tools/run_tests/run_tests.py
+
2
−
2
View file @
2a2a6ed1
...
@@ -485,10 +485,10 @@ _CONFIGS = {
...
@@ -485,10 +485,10 @@ _CONFIGS = {
'
msan
'
:
SimpleConfig
(
'
msan
'
,
timeout_multiplier
=
1.5
),
'
msan
'
:
SimpleConfig
(
'
msan
'
,
timeout_multiplier
=
1.5
),
'
ubsan
'
:
SimpleConfig
(
'
ubsan
'
),
'
ubsan
'
:
SimpleConfig
(
'
ubsan
'
),
'
asan
'
:
SimpleConfig
(
'
asan
'
,
timeout_multiplier
=
1.5
,
environ
=
{
'
asan
'
:
SimpleConfig
(
'
asan
'
,
timeout_multiplier
=
1.5
,
environ
=
{
'
ASAN_OPTIONS
'
:
'
detect_leaks=1:color=always
:suppressions=tools/tsan_suppressions.txt
'
,
'
ASAN_OPTIONS
'
:
'
detect_leaks=1:color=always
'
,
'
LSAN_OPTIONS
'
:
'
report_objects=1
'
}),
'
LSAN_OPTIONS
'
:
'
report_objects=1
'
}),
'
asan-noleaks
'
:
SimpleConfig
(
'
asan
'
,
environ
=
{
'
asan-noleaks
'
:
SimpleConfig
(
'
asan
'
,
environ
=
{
'
ASAN_OPTIONS
'
:
'
detect_leaks=0:color=always
:suppressions=tools/tsan_suppressions.txt
'
}),
'
ASAN_OPTIONS
'
:
'
detect_leaks=0:color=always
'
}),
'
gcov
'
:
SimpleConfig
(
'
gcov
'
),
'
gcov
'
:
SimpleConfig
(
'
gcov
'
),
'
memcheck
'
:
ValgrindConfig
(
'
valgrind
'
,
'
memcheck
'
,
[
'
--leak-check=full
'
]),
'
memcheck
'
:
ValgrindConfig
(
'
valgrind
'
,
'
memcheck
'
,
[
'
--leak-check=full
'
]),
'
helgrind
'
:
ValgrindConfig
(
'
dbg
'
,
'
helgrind
'
)
'
helgrind
'
:
ValgrindConfig
(
'
dbg
'
,
'
helgrind
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment