Read new env var to toggle

pull/13289/head
ncteisen 7 years ago
parent 228089f7b8
commit a77fb7dc67
  1. 18
      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. */

Loading…
Cancel
Save