Read new env var to toggle
diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
index 768cee1..f300ae9 100644
--- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
+++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
@@ -261,6 +261,9 @@
static const grpc_transport_vtable* get_vtable(void);
+// -1 == unset, 0 == disabled, 1 == enabled
+static int flow_control_enabled = -1;
+
static void init_transport(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
const grpc_channel_args* channel_args,
grpc_endpoint* ep, bool is_client) {
@@ -544,12 +547,19 @@
}
}
- if (true /* disable flow control*/) {
- t->flow_control.Init<grpc_core::chttp2::TransportFlowControlDisabled>(t);
- enable_bdp = false;
- } else {
+ if (flow_control_enabled == -1) {
+ char* env_variable = gpr_getenv("GRPC_EXPERIMENTAL_DISABLE_FLOW_CONTROL");
+ if (env_variable != nullptr) flow_control_enabled = 0;
+ else flow_control_enabled = 1;
+ gpr_free(env_variable);
+ }
+
+ if (flow_control_enabled) {
t->flow_control.Init<grpc_core::chttp2::TransportFlowControl>(exec_ctx, t,
enable_bdp);
+ } else {
+ t->flow_control.Init<grpc_core::chttp2::TransportFlowControlDisabled>(t);
+ enable_bdp = false;
}
/* No pings allowed before receiving a header or data frame. */