HTTP2: Fix keepalive time throttling (#30164)

pull/30444/head^2
Yash Tibrewal 3 years ago committed by GitHub
parent e18d335b0e
commit 658632fcd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      src/core/ext/transport/chttp2/transport/chttp2_transport.cc

@ -1128,14 +1128,14 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
gpr_log(GPR_ERROR,
"Received a GOAWAY with error code ENHANCE_YOUR_CALM and debug "
"data equal to \"too_many_pings\"");
constexpr auto max_keepalive_time = grpc_core::Duration::Milliseconds(
INT_MAX / KEEPALIVE_TIME_BACKOFF_MULTIPLIER);
t->keepalive_time =
t->keepalive_time > max_keepalive_time
? grpc_core::Duration::Infinity()
: t->keepalive_time * KEEPALIVE_TIME_BACKOFF_MULTIPLIER;
constexpr int max_keepalive_time_millis =
INT_MAX / KEEPALIVE_TIME_BACKOFF_MULTIPLIER;
int throttled_keepalive_time =
t->keepalive_time.millis() > max_keepalive_time_millis
? INT_MAX
: t->keepalive_time.millis() * KEEPALIVE_TIME_BACKOFF_MULTIPLIER;
status.SetPayload(grpc_core::kKeepaliveThrottlingKey,
absl::Cord(std::to_string(t->keepalive_time.millis())));
absl::Cord(std::to_string(throttled_keepalive_time)));
}
// lie: use transient failure from the transport to indicate goaway has been
// received.

Loading…
Cancel
Save