diff options
author | 2017-11-16 11:26:43 -0800 | |
---|---|---|
committer | 2017-11-16 11:26:43 -0800 | |
commit | 1028787b5a87440f9f46c5b402166bc10b59b7f8 (patch) | |
tree | 5b42466e3597dacd6f615c4c5133bb22d62e818a /src/core | |
parent | 68ade7471c047d0aac34f04c91e3ed5e319a32f1 (diff) |
Add constant kMaxDt
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/ext/transport/chttp2/transport/flow_control.cc | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/core/ext/transport/chttp2/transport/flow_control.cc b/src/core/ext/transport/chttp2/transport/flow_control.cc index f92e003405..b4e3118043 100644 --- a/src/core/ext/transport/chttp2/transport/flow_control.cc +++ b/src/core/ext/transport/chttp2/transport/flow_control.cc @@ -310,13 +310,11 @@ double TransportFlowControl::SmoothLogBdp(grpc_exec_ctx* exec_ctx, double value) { grpc_millis now = grpc_exec_ctx_now(exec_ctx); double bdp_error = value - pid_controller_.last_control_value(); - double dt = (double)(now - last_pid_update_) * 1e-3; - // Limit dt to 100ms - if (dt > 0.1) { - dt = 0.1; - } + const double dt = (double)(now - last_pid_update_) * 1e-3; last_pid_update_ = now; - return pid_controller_.Update(bdp_error, dt); + // Limit dt to 100ms + const double kMaxDt = 0.1; + return pid_controller_.Update(bdp_error, dt > kMaxDt ? kMaxDt : dt); } FlowControlAction::Urgency TransportFlowControl::DeltaUrgency( |