Merge remote-tracking branch 'upstream/master' into backward-compat-dev
diff --git a/include/grpc++/server_builder.h b/include/grpc++/server_builder.h
index a56f81d..2dcd070 100644
--- a/include/grpc++/server_builder.h
+++ b/include/grpc++/server_builder.h
@@ -184,6 +184,11 @@
static void InternalAddPluginFactory(
std::unique_ptr<ServerBuilderPlugin> (*CreatePlugin)());
+ /// Enable a server workaround. Do not use unless you know what the workaround
+ /// does. For explanation and detailed descriptions of workarounds, see
+ /// docs/workarounds.md.
+ ServerBuilder& EnableWorkaround(uint32_t id);
+
private:
friend class ::grpc::testing::ServerBuilderPluginTest;
diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc
index 2ead048..797a8eb 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"
@@ -358,4 +359,14 @@
(*g_plugin_factory_list).push_back(CreatePlugin);
}
+ServerBuilder& ServerBuilder::EnableWorkaround(uint32_t id) {
+ switch (id) {
+ case GRPC_WORKAROUND_ID_CRONET_COMPRESSION:
+ return AddChannelArgument(GRPC_ARG_WORKAROUND_CRONET_COMPRESSION, 1);
+ default:
+ gpr_log(GPR_ERROR, "Workaround %u does not exist or is obsolete.", id);
+ return *this;
+ }
+}
+
} // namespace grpc