aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/ext
diff options
context:
space:
mode:
authorGravatar yang-g <yangg@google.com>2017-12-05 17:34:48 -0800
committerGravatar yang-g <yangg@google.com>2017-12-05 17:34:48 -0800
commitd742f2893fba18d6c4a7b7e780fb4d79b8232a3b (patch)
tree70bc86cce0f3f87e9cf8400ecee064b48719c4c2 /src/core/ext
parent08aa228771c639a20e45e47120e1c667d8ac7344 (diff)
Bug fix, use the last_sent ping time for next send
Diffstat (limited to 'src/core/ext')
-rw-r--r--src/core/ext/transport/chttp2/transport/writing.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/core/ext/transport/chttp2/transport/writing.cc b/src/core/ext/transport/chttp2/transport/writing.cc
index 204b5a7708..cfaa0d0f70 100644
--- a/src/core/ext/transport/chttp2/transport/writing.cc
+++ b/src/core/ext/transport/chttp2/transport/writing.cc
@@ -69,14 +69,15 @@ static void maybe_initiate_ping(grpc_exec_ctx* exec_ctx,
return;
}
grpc_millis now = grpc_exec_ctx_now(exec_ctx);
+
+ grpc_millis next_allowed_ping_interval =
+ (t->keepalive_permit_without_calls == 0 &&
+ grpc_chttp2_stream_map_size(&t->stream_map) == 0)
+ ? 7200 * GPR_MS_PER_SEC
+ : t->ping_policy.min_sent_ping_interval_without_data;
grpc_millis next_allowed_ping =
- t->ping_state.last_ping_sent_time +
- t->ping_policy.min_sent_ping_interval_without_data;
- if (t->keepalive_permit_without_calls == 0 &&
- grpc_chttp2_stream_map_size(&t->stream_map) == 0) {
- next_allowed_ping =
- t->ping_recv_state.last_ping_recv_time + 7200 * GPR_MS_PER_SEC;
- }
+ t->ping_state.last_ping_sent_time + next_allowed_ping_interval;
+
if (next_allowed_ping > now) {
/* not enough elapsed time between successive pings */
if (grpc_http_trace.enabled() || grpc_bdp_estimator_trace.enabled()) {