Skip to content
Snippets Groups Projects
Commit 25d71cd6 authored by Muxi Yan's avatar Muxi Yan
Browse files

remove enable_workaround

parent 21be59b8
No related branches found
No related tags found
No related merge requests found
...@@ -211,7 +211,6 @@ static bool register_workaround_cronet_compression( ...@@ -211,7 +211,6 @@ static bool register_workaround_cronet_compression(
if (grpc_channel_arg_get_bool(a, false) == false) { if (grpc_channel_arg_get_bool(a, false) == false) {
return true; return true;
} }
grpc_enable_workaround(GRPC_WORKAROUND_ID_CRONET_COMPRESSION);
return grpc_channel_stack_builder_prepend_filter( return grpc_channel_stack_builder_prepend_filter(
builder, &grpc_workaround_cronet_compression_filter, NULL, NULL); builder, &grpc_workaround_cronet_compression_filter, NULL, NULL);
} }
... ...
......
...@@ -34,12 +34,7 @@ ...@@ -34,12 +34,7 @@
#include <grpc/support/alloc.h> #include <grpc/support/alloc.h>
#include <grpc/support/log.h> #include <grpc/support/log.h>
typedef struct { user_agent_parser ua_parser[GRPC_MAX_WORKAROUND_ID];
bool enabled;
user_agent_parser ua_parser;
} workaround_context;
static workaround_context workarounds[GRPC_MAX_WORKAROUND_ID];
static void destroy_user_agent_md(void *user_agent_md) { static void destroy_user_agent_md(void *user_agent_md) {
gpr_free(user_agent_md); gpr_free(user_agent_md);
...@@ -55,8 +50,8 @@ grpc_workaround_user_agent_md *grpc_parse_user_agent(grpc_mdelem 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)); user_agent_md = gpr_malloc(sizeof(grpc_workaround_user_agent_md));
for (int i = 0; i < GRPC_MAX_WORKAROUND_ID; i++) { for (int i = 0; i < GRPC_MAX_WORKAROUND_ID; i++) {
if (workarounds[i].enabled && workarounds[i].ua_parser) { if (ua_parser[i]) {
user_agent_md->workaround_active[i] = workarounds[i].ua_parser(md); user_agent_md->workaround_active[i] = ua_parser[i](md);
} }
} }
grpc_mdelem_set_user_data(md, destroy_user_agent_md, (void *)user_agent_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) { ...@@ -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) { void grpc_register_workaround(uint32_t id, user_agent_parser parser) {
GPR_ASSERT(id < GRPC_MAX_WORKAROUND_ID); 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;
}
...@@ -49,6 +49,5 @@ typedef bool (*user_agent_parser)(grpc_mdelem); ...@@ -49,6 +49,5 @@ typedef bool (*user_agent_parser)(grpc_mdelem);
void grpc_register_workaround(uint32_t id, user_agent_parser parser); void grpc_register_workaround(uint32_t id, user_agent_parser parser);
void grpc_enable_workaround(uint32_t id);
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment