aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/ext/transport/chttp2
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2017-11-13 15:37:58 -0800
committerGravatar Yash Tibrewal <yashkt@google.com>2017-11-14 01:36:28 -0800
commit75122c23578e24417dcf64081c737571a9fc2dbc (patch)
treef4b8491964ec0508a5826490628c9f87b82c3326 /src/core/ext/transport/chttp2
parent36cd68f0d543b9024c84eff82319890a791de7f6 (diff)
Address some PR comments
Diffstat (limited to 'src/core/ext/transport/chttp2')
-rw-r--r--src/core/ext/transport/chttp2/client/insecure/channel_create.cc2
-rw-r--r--src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc2
-rw-r--r--src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc1
-rw-r--r--src/core/ext/transport/chttp2/server/chttp2_server.cc6
-rw-r--r--src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc2
-rw-r--r--src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc1
-rw-r--r--src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc2
-rw-r--r--src/core/ext/transport/chttp2/transport/chttp2_transport.cc10
-rw-r--r--src/core/ext/transport/chttp2/transport/flow_control.cc4
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_ping.cc2
-rw-r--r--src/core/ext/transport/chttp2/transport/hpack_encoder.cc2
-rw-r--r--src/core/ext/transport/chttp2/transport/parsing.cc2
-rw-r--r--src/core/ext/transport/chttp2/transport/writing.cc2
13 files changed, 17 insertions, 21 deletions
diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create.cc b/src/core/ext/transport/chttp2/client/insecure/channel_create.cc
index e7741f97d4..3afca884ca 100644
--- a/src/core/ext/transport/chttp2/client/insecure/channel_create.cc
+++ b/src/core/ext/transport/chttp2/client/insecure/channel_create.cc
@@ -95,7 +95,7 @@ grpc_channel* grpc_insecure_channel_create(const char* target,
new_args);
// Clean up.
grpc_channel_args_destroy(new_args);
- grpc_exec_ctx_finish();
+
return channel != NULL ? channel
: grpc_lame_client_channel_create(
target, GRPC_STATUS_INTERNAL,
diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc b/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc
index 37e6f1f30d..b0eff1c992 100644
--- a/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc
+++ b/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc
@@ -60,8 +60,6 @@ grpc_channel* grpc_insecure_channel_create_from_fd(
grpc_channel_args_destroy(final_args);
grpc_chttp2_transport_start_reading(transport, NULL);
- grpc_exec_ctx_finish();
-
return channel != NULL ? channel
: grpc_lame_client_channel_create(
target, GRPC_STATUS_INTERNAL,
diff --git a/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc b/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc
index a5da71a67c..bebc38c248 100644
--- a/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc
+++ b/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc
@@ -211,7 +211,6 @@ grpc_channel* grpc_secure_channel_create(grpc_channel_credentials* creds,
new_args);
// Clean up.
grpc_channel_args_destroy(new_args);
- grpc_exec_ctx_finish();
}
return channel != NULL ? channel
: grpc_lame_client_channel_create(
diff --git a/src/core/ext/transport/chttp2/server/chttp2_server.cc b/src/core/ext/transport/chttp2/server/chttp2_server.cc
index 6eb1e3491c..bbcfb1b195 100644
--- a/src/core/ext/transport/chttp2/server/chttp2_server.cc
+++ b/src/core/ext/transport/chttp2/server/chttp2_server.cc
@@ -132,7 +132,7 @@ static void on_accept(void* arg, grpc_endpoint* tcp,
connection_state->handshake_mgr);
// TODO(roth): We should really get this timeout value from channel
// args instead of hard-coding it.
- const grpc_millis deadline = grpc_exec_ctx_now() + 120 * GPR_MS_PER_SEC;
+ const grpc_millis deadline = ExecCtx::Get()->Now() + 120 * GPR_MS_PER_SEC;
grpc_handshake_manager_do_handshake(connection_state->handshake_mgr, tcp,
state->args, deadline, acceptor,
on_handshake_done, connection_state);
@@ -161,10 +161,10 @@ static void tcp_server_shutdown_complete(void* arg, grpc_error* error) {
gpr_mu_unlock(&state->mu);
// Flush queued work before destroying handshaker factory, since that
// may do a synchronous unref.
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
if (destroy_done != NULL) {
destroy_done->cb(destroy_done->cb_arg, GRPC_ERROR_REF(error));
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
}
grpc_channel_args_destroy(state->args);
gpr_mu_destroy(&state->mu);
diff --git a/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc b/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc
index d7aad110b9..6cbb26a349 100644
--- a/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc
+++ b/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc
@@ -39,6 +39,6 @@ int grpc_server_add_insecure_http2_port(grpc_server* server, const char* addr) {
GRPC_ERROR_UNREF(err);
}
- grpc_exec_ctx_finish();
+
return port_num;
}
diff --git a/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc b/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc
index 57a8316a58..e5419e5e6e 100644
--- a/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc
+++ b/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc
@@ -61,7 +61,6 @@ void grpc_server_add_insecure_channel_from_fd(grpc_server* server,
grpc_server_setup_transport(server, transport, NULL, server_args);
grpc_chttp2_transport_start_reading(transport, NULL);
- grpc_exec_ctx_finish();
}
#else // !GPR_SUPPORT_CHANNELS_FROM_FD
diff --git a/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc b/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc
index dc7da96210..aeae8f42e3 100644
--- a/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc
+++ b/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc
@@ -76,7 +76,7 @@ done:
if (sc != NULL) {
GRPC_SECURITY_CONNECTOR_UNREF(&sc->base, "server");
}
- grpc_exec_ctx_finish();
+
if (err != GRPC_ERROR_NONE) {
const char* msg = grpc_error_string(err);
gpr_log(GPR_ERROR, "%s", msg);
diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
index ecf3cf69ef..e49e26fc35 100644
--- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
+++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
@@ -530,7 +530,7 @@ static void init_transport(grpc_chttp2_transport* t,
t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_WAITING;
GRPC_CHTTP2_REF_TRANSPORT(t, "init keepalive ping");
grpc_timer_init(&t->keepalive_ping_timer,
- grpc_exec_ctx_now() + t->keepalive_time,
+ ExecCtx::Get()->Now() + t->keepalive_time,
&t->init_keepalive_ping_locked);
} else {
/* Use GRPC_CHTTP2_KEEPALIVE_STATE_DISABLED to indicate there are no
@@ -2585,14 +2585,14 @@ static void init_keepalive_ping_locked(void* arg, grpc_error* error) {
} else {
GRPC_CHTTP2_REF_TRANSPORT(t, "init keepalive ping");
grpc_timer_init(&t->keepalive_ping_timer,
- grpc_exec_ctx_now() + t->keepalive_time,
+ ExecCtx::Get()->Now() + t->keepalive_time,
&t->init_keepalive_ping_locked);
}
} else if (error == GRPC_ERROR_CANCELLED) {
/* The keepalive ping timer may be cancelled by bdp */
GRPC_CHTTP2_REF_TRANSPORT(t, "init keepalive ping");
grpc_timer_init(&t->keepalive_ping_timer,
- grpc_exec_ctx_now() + t->keepalive_time,
+ ExecCtx::Get()->Now() + t->keepalive_time,
&t->init_keepalive_ping_locked);
}
GRPC_CHTTP2_UNREF_TRANSPORT(t, "init keepalive ping");
@@ -2602,7 +2602,7 @@ static void start_keepalive_ping_locked(void* arg, grpc_error* error) {
grpc_chttp2_transport* t = (grpc_chttp2_transport*)arg;
GRPC_CHTTP2_REF_TRANSPORT(t, "keepalive watchdog");
grpc_timer_init(&t->keepalive_watchdog_timer,
- grpc_exec_ctx_now() + t->keepalive_time,
+ ExecCtx::Get()->Now() + t->keepalive_time,
&t->keepalive_watchdog_fired_locked);
}
@@ -2614,7 +2614,7 @@ static void finish_keepalive_ping_locked(void* arg, grpc_error* error) {
grpc_timer_cancel(&t->keepalive_watchdog_timer);
GRPC_CHTTP2_REF_TRANSPORT(t, "init keepalive ping");
grpc_timer_init(&t->keepalive_ping_timer,
- grpc_exec_ctx_now() + t->keepalive_time,
+ ExecCtx::Get()->Now() + t->keepalive_time,
&t->init_keepalive_ping_locked);
}
}
diff --git a/src/core/ext/transport/chttp2/transport/flow_control.cc b/src/core/ext/transport/chttp2/transport/flow_control.cc
index 1609fa0532..e54d59b5fa 100644
--- a/src/core/ext/transport/chttp2/transport/flow_control.cc
+++ b/src/core/ext/transport/chttp2/transport/flow_control.cc
@@ -160,7 +160,7 @@ TransportFlowControl::TransportFlowControl(const grpc_chttp2_transport* t,
.set_min_control_value(-1)
.set_max_control_value(25)
.set_integral_range(10)),
- last_pid_update_(grpc_exec_ctx_now()) {}
+ last_pid_update_(ExecCtx::Get()->Now()) {}
uint32_t TransportFlowControl::MaybeSendUpdate(bool writing_anyway) {
FlowControlTrace trace("t updt sent", this, nullptr);
@@ -306,7 +306,7 @@ double TransportFlowControl::TargetLogBdp() {
}
double TransportFlowControl::SmoothLogBdp(double value) {
- grpc_millis now = grpc_exec_ctx_now();
+ grpc_millis now = ExecCtx::Get()->Now();
double bdp_error = value - pid_controller_.last_control_value();
const double dt = (double)(now - last_pid_update_) * 1e-3;
last_pid_update_ = now;
diff --git a/src/core/ext/transport/chttp2/transport/frame_ping.cc b/src/core/ext/transport/chttp2/transport/frame_ping.cc
index 1b0dc0dfaa..60172be9cb 100644
--- a/src/core/ext/transport/chttp2/transport/frame_ping.cc
+++ b/src/core/ext/transport/chttp2/transport/frame_ping.cc
@@ -89,7 +89,7 @@ grpc_error* grpc_chttp2_ping_parser_parse(void* parser,
grpc_chttp2_ack_ping(t, p->opaque_8bytes);
} else {
if (!t->is_client) {
- grpc_millis now = grpc_exec_ctx_now();
+ grpc_millis now = ExecCtx::Get()->Now();
grpc_millis next_allowed_ping =
t->ping_recv_state.last_ping_recv_time +
t->ping_policy.min_recv_ping_interval_without_data;
diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc
index e225a0244a..efb6e54ce7 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc
+++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc
@@ -570,7 +570,7 @@ static void deadline_enc(grpc_chttp2_hpack_compressor* c, grpc_millis deadline,
framer_state* st) {
char timeout_str[GRPC_HTTP2_TIMEOUT_ENCODE_MIN_BUFSIZE];
grpc_mdelem mdelem;
- grpc_http2_encode_timeout(deadline - grpc_exec_ctx_now(), timeout_str);
+ grpc_http2_encode_timeout(deadline - ExecCtx::Get()->Now(), timeout_str);
mdelem = grpc_mdelem_from_slices(GRPC_MDSTR_GRPC_TIMEOUT,
grpc_slice_from_copied_string(timeout_str));
hpack_enc(c, mdelem, st);
diff --git a/src/core/ext/transport/chttp2/transport/parsing.cc b/src/core/ext/transport/chttp2/transport/parsing.cc
index 5731e9ff78..f7f83c9aee 100644
--- a/src/core/ext/transport/chttp2/transport/parsing.cc
+++ b/src/core/ext/transport/chttp2/transport/parsing.cc
@@ -436,7 +436,7 @@ static void on_initial_header(void* tp, grpc_mdelem md) {
}
if (timeout != GRPC_MILLIS_INF_FUTURE) {
grpc_chttp2_incoming_metadata_buffer_set_deadline(
- &s->metadata_buffer[0], grpc_exec_ctx_now() + timeout);
+ &s->metadata_buffer[0], ExecCtx::Get()->Now() + timeout);
}
GRPC_MDELEM_UNREF(md);
} else {
diff --git a/src/core/ext/transport/chttp2/transport/writing.cc b/src/core/ext/transport/chttp2/transport/writing.cc
index ec83633472..4f76c2eb23 100644
--- a/src/core/ext/transport/chttp2/transport/writing.cc
+++ b/src/core/ext/transport/chttp2/transport/writing.cc
@@ -68,7 +68,7 @@ static void maybe_initiate_ping(grpc_chttp2_transport* t) {
}
return;
}
- grpc_millis now = grpc_exec_ctx_now();
+ grpc_millis now = ExecCtx::Get()->Now();
grpc_millis next_allowed_ping =
t->ping_state.last_ping_sent_time +
t->ping_policy.min_sent_ping_interval_without_data;