aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2017-05-09 16:04:10 -0700
committerGravatar Muxi Yan <mxyan@google.com>2017-05-09 16:26:51 -0700
commitcdc0d03b2d868027f7b0158422885d58cc7b17ab (patch)
treeccbca46c594e2abffd26f3ef057a7069e18aed9a /src/cpp
parente74b9aeaa2987f8813d431684a30c675fd4b3acd (diff)
Add EnableWorkaround API to enable server workarounds
Diffstat (limited to 'src/cpp')
-rw-r--r--src/cpp/server/server_builder.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc
index 2ead048a1f..67a7846da5 100644
--- a/src/cpp/server/server_builder.cc
+++ b/src/cpp/server/server_builder.cc
@@ -39,6 +39,7 @@
#include <grpc/support/cpu.h>
#include <grpc/support/log.h>
#include <grpc/support/useful.h>
+#include <grpc/support/workaround_list.h>
#include "src/cpp/server/thread_pool_interface.h"
@@ -198,6 +199,10 @@ std::unique_ptr<Server> ServerBuilder::BuildAndStart() {
args.SetInt(GRPC_ARG_MAX_SEND_MESSAGE_LENGTH, max_send_message_size_);
}
+ for (auto workaround : enabled_workarounds_) {
+ args.SetInt(workaround, 1);
+ }
+
args.SetInt(GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET,
enabled_compression_algorithms_bitset_);
if (maybe_default_compression_level_.is_set) {
@@ -358,4 +363,14 @@ void ServerBuilder::InternalAddPluginFactory(
(*g_plugin_factory_list).push_back(CreatePlugin);
}
+void ServerBuilder::EnableWorkaround(uint32_t id) {
+ switch (id) {
+ case GRPC_WORKAROUND_ID_CRONET_COMPRESSION:
+ enabled_workarounds_.push_back(GRPC_ARG_WORKAROUND_CRONET_COMPRESSION);
+ break;
+ default:
+ gpr_log(GPR_ERROR, "Workaround %u is not exist or obsolete.", id);
+ }
+}
+
} // namespace grpc