aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/ext/filters/workarounds
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2017-05-10 09:42:49 -0700
committerGravatar Muxi Yan <mxyan@google.com>2017-05-10 09:42:49 -0700
commit25d71cd6d8c34636d08f3ad2a9e2eeb69c3a3905 (patch)
tree874592e447233d69934d1844dc4663a562720675 /src/core/ext/filters/workarounds
parent21be59b8dd59be20857048336477f090d78eff06 (diff)
remove enable_workaround
Diffstat (limited to 'src/core/ext/filters/workarounds')
-rw-r--r--src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c1
-rw-r--r--src/core/ext/filters/workarounds/workaround_utils.c17
-rw-r--r--src/core/ext/filters/workarounds/workaround_utils.h3
3 files changed, 5 insertions, 16 deletions
diff --git a/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c b/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c
index af30d21141..7872ef2d12 100644
--- a/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c
+++ b/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c
@@ -211,7 +211,6 @@ static bool register_workaround_cronet_compression(
if (grpc_channel_arg_get_bool(a, false) == false) {
return true;
}
- grpc_enable_workaround(GRPC_WORKAROUND_ID_CRONET_COMPRESSION);
return grpc_channel_stack_builder_prepend_filter(
builder, &grpc_workaround_cronet_compression_filter, NULL, NULL);
}
diff --git a/src/core/ext/filters/workarounds/workaround_utils.c b/src/core/ext/filters/workarounds/workaround_utils.c
index 8f90a3d1a9..c6002e3fb9 100644
--- a/src/core/ext/filters/workarounds/workaround_utils.c
+++ b/src/core/ext/filters/workarounds/workaround_utils.c
@@ -34,12 +34,7 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-typedef struct {
- bool enabled;
- user_agent_parser ua_parser;
-} workaround_context;
-
-static workaround_context workarounds[GRPC_MAX_WORKAROUND_ID];
+user_agent_parser ua_parser[GRPC_MAX_WORKAROUND_ID];
static void destroy_user_agent_md(void *user_agent_md) {
gpr_free(user_agent_md);
@@ -55,8 +50,8 @@ grpc_workaround_user_agent_md *grpc_parse_user_agent(grpc_mdelem md) {
}
user_agent_md = gpr_malloc(sizeof(grpc_workaround_user_agent_md));
for (int i = 0; i < GRPC_MAX_WORKAROUND_ID; i++) {
- if (workarounds[i].enabled && workarounds[i].ua_parser) {
- user_agent_md->workaround_active[i] = workarounds[i].ua_parser(md);
+ if (ua_parser[i]) {
+ user_agent_md->workaround_active[i] = ua_parser[i](md);
}
}
grpc_mdelem_set_user_data(md, destroy_user_agent_md, (void *)user_agent_md);
@@ -66,10 +61,6 @@ grpc_workaround_user_agent_md *grpc_parse_user_agent(grpc_mdelem md) {
void grpc_register_workaround(uint32_t id, user_agent_parser parser) {
GPR_ASSERT(id < GRPC_MAX_WORKAROUND_ID);
- workarounds[id].ua_parser = parser;
+ ua_parser[id] = parser;
}
-void grpc_enable_workaround(uint32_t id) {
- GPR_ASSERT(id < GRPC_MAX_WORKAROUND_ID);
- workarounds[id].enabled = true;
-}
diff --git a/src/core/ext/filters/workarounds/workaround_utils.h b/src/core/ext/filters/workarounds/workaround_utils.h
index 19528ab165..f4c6e5b14d 100644
--- a/src/core/ext/filters/workarounds/workaround_utils.h
+++ b/src/core/ext/filters/workarounds/workaround_utils.h
@@ -49,6 +49,5 @@ typedef bool (*user_agent_parser)(grpc_mdelem);
void grpc_register_workaround(uint32_t id, user_agent_parser parser);
-void grpc_enable_workaround(uint32_t id);
-
#endif
+