diff options
author | Yuchen Zeng <zyc@google.com> | 2017-09-19 11:44:15 -0700 |
---|---|---|
committer | Yuchen Zeng <zyc@google.com> | 2017-09-19 11:44:55 -0700 |
commit | 4ebcab42f9fda2a045522caddf84296355e3b2a6 (patch) | |
tree | 94010ea6539200e6c367fe99a14b453c69c6285a /src | |
parent | 0aedb8136fe935e0361c8bfa5ef8b46b4d191605 (diff) |
Reset server-side ping enforcement after send trailing metadata
Diffstat (limited to 'src')
-rw-r--r-- | src/core/ext/transport/chttp2/transport/writing.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/core/ext/transport/chttp2/transport/writing.c b/src/core/ext/transport/chttp2/transport/writing.c index 7d9d4867e1..66e6971326 100644 --- a/src/core/ext/transport/chttp2/transport/writing.c +++ b/src/core/ext/transport/chttp2/transport/writing.c @@ -62,7 +62,8 @@ static void maybe_initiate_ping(grpc_exec_ctx *exec_ctx, /* ping already in-flight: wait */ if (GRPC_TRACER_ON(grpc_http_trace) || GRPC_TRACER_ON(grpc_bdp_estimator_trace)) { - gpr_log(GPR_DEBUG, "Ping delayed [%p]: already pinging", t->peer_string); + gpr_log(GPR_DEBUG, "%s: Ping delayed [%p]: already pinging", + t->is_client ? "CLIENT" : "SERVER", t->peer_string); } return; } @@ -71,8 +72,9 @@ static void maybe_initiate_ping(grpc_exec_ctx *exec_ctx, /* need to receive something of substance before sending a ping again */ if (GRPC_TRACER_ON(grpc_http_trace) || GRPC_TRACER_ON(grpc_bdp_estimator_trace)) { - gpr_log(GPR_DEBUG, "Ping delayed [%p]: too many recent pings: %d/%d", - t->peer_string, t->ping_state.pings_before_data_required, + gpr_log(GPR_DEBUG, "%s: Ping delayed [%p]: too many recent pings: %d/%d", + t->is_client ? "CLIENT" : "SERVER", t->peer_string, + t->ping_state.pings_before_data_required, t->ping_policy.max_pings_without_data); } return; @@ -94,8 +96,8 @@ static void maybe_initiate_ping(grpc_exec_ctx *exec_ctx, if (GRPC_TRACER_ON(grpc_http_trace) || GRPC_TRACER_ON(grpc_bdp_estimator_trace)) { gpr_log(GPR_DEBUG, - "Ping delayed [%p]: not enough time elapsed since last ping", - t->peer_string); + "%s: Ping delayed [%p]: not enough time elapsed since last ping", + t->is_client ? "CLIENT" : "SERVER", t->peer_string); } if (!t->ping_state.is_delayed_ping_timer_set) { t->ping_state.is_delayed_ping_timer_set = true; @@ -126,7 +128,8 @@ static void maybe_initiate_ping(grpc_exec_ctx *exec_ctx, t->ping_state.last_ping_sent_time = now; if (GRPC_TRACER_ON(grpc_http_trace) || GRPC_TRACER_ON(grpc_bdp_estimator_trace)) { - gpr_log(GPR_DEBUG, "Ping sent [%p]: %d/%d", t->peer_string, + gpr_log(GPR_DEBUG, "%s: Ping sent [%p]: %d/%d", + t->is_client ? "CLIENT" : "SERVER", t->peer_string, t->ping_state.pings_before_data_required, t->ping_policy.max_pings_without_data); } @@ -451,6 +454,11 @@ grpc_chttp2_begin_write_result grpc_chttp2_begin_write( } s->send_trailing_metadata = NULL; s->sent_trailing_metadata = true; + if (!t->is_client) { + t->ping_recv_state.last_ping_recv_time = + gpr_inf_past(GPR_CLOCK_MONOTONIC); + t->ping_recv_state.ping_strikes = 0; + } if (!t->is_client && !s->read_closed) { grpc_slice_buffer_add( &t->outbuf, grpc_chttp2_rst_stream_create( |