diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/ext/transport/chttp2/transport/chttp2_transport.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index 768cee1190..f300ae9188 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 @@ void grpc_chttp2_ref_transport(grpc_chttp2_transport* t) { gpr_ref(&t->refs); } 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 @@ static void init_transport(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t, } } - 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. */ |