|
|
|
@ -34,6 +34,7 @@ |
|
|
|
|
#include "src/core/ext/transport/chttp2/transport/varint.h" |
|
|
|
|
#include "src/core/lib/channel/channel_args.h" |
|
|
|
|
#include "src/core/lib/http/parser.h" |
|
|
|
|
#include "src/core/lib/iomgr/executor.h" |
|
|
|
|
#include "src/core/lib/iomgr/timer.h" |
|
|
|
|
#include "src/core/lib/profiling/timers.h" |
|
|
|
|
#include "src/core/lib/slice/slice_internal.h" |
|
|
|
@ -269,8 +270,6 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, |
|
|
|
|
grpc_slice_buffer_init(&t->outbuf); |
|
|
|
|
grpc_chttp2_hpack_compressor_init(&t->hpack_compressor); |
|
|
|
|
|
|
|
|
|
GRPC_CLOSURE_INIT(&t->write_action, write_action, t, |
|
|
|
|
grpc_schedule_on_exec_ctx); |
|
|
|
|
GRPC_CLOSURE_INIT(&t->read_action_locked, read_action_locked, t, |
|
|
|
|
grpc_combiner_scheduler(t->combiner)); |
|
|
|
|
GRPC_CLOSURE_INIT(&t->benign_reclaimer_locked, benign_reclaimer_locked, t, |
|
|
|
@ -387,6 +386,8 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, |
|
|
|
|
} |
|
|
|
|
t->keepalive_permit_without_calls = g_default_keepalive_permit_without_calls; |
|
|
|
|
|
|
|
|
|
t->opt_target = GRPC_CHTTP2_OPTIMIZE_FOR_LATENCY; |
|
|
|
|
|
|
|
|
|
if (channel_args) { |
|
|
|
|
for (i = 0; i < channel_args->num_args; i++) { |
|
|
|
|
if (0 == strcmp(channel_args->args[i].key, |
|
|
|
@ -475,6 +476,23 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, |
|
|
|
|
t->keepalive_permit_without_calls = |
|
|
|
|
(uint32_t)grpc_channel_arg_get_integer( |
|
|
|
|
&channel_args->args[i], (grpc_integer_options){0, 0, 1}); |
|
|
|
|
} else if (0 == strcmp(channel_args->args[i].key, |
|
|
|
|
GRPC_ARG_OPTIMIZATION_TARGET)) { |
|
|
|
|
if (channel_args->args[i].type != GRPC_ARG_STRING) { |
|
|
|
|
gpr_log(GPR_ERROR, "%s should be a string", |
|
|
|
|
GRPC_ARG_OPTIMIZATION_TARGET); |
|
|
|
|
} else if (0 == strcmp(channel_args->args[i].value.string, "blend")) { |
|
|
|
|
t->opt_target = GRPC_CHTTP2_OPTIMIZE_FOR_LATENCY; |
|
|
|
|
} else if (0 == strcmp(channel_args->args[i].value.string, "latency")) { |
|
|
|
|
t->opt_target = GRPC_CHTTP2_OPTIMIZE_FOR_LATENCY; |
|
|
|
|
} else if (0 == |
|
|
|
|
strcmp(channel_args->args[i].value.string, "throughput")) { |
|
|
|
|
t->opt_target = GRPC_CHTTP2_OPTIMIZE_FOR_THROUGHPUT; |
|
|
|
|
} else { |
|
|
|
|
gpr_log(GPR_ERROR, "%s value '%s' unknown, assuming 'blend'", |
|
|
|
|
GRPC_ARG_OPTIMIZATION_TARGET, |
|
|
|
|
channel_args->args[i].value.string); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
static const struct { |
|
|
|
|
const char *channel_arg_name; |
|
|
|
@ -528,6 +546,11 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
GRPC_CLOSURE_INIT(&t->write_action, write_action, t, |
|
|
|
|
t->opt_target == GRPC_CHTTP2_OPTIMIZE_FOR_THROUGHPUT |
|
|
|
|
? grpc_executor_scheduler |
|
|
|
|
: grpc_schedule_on_exec_ctx); |
|
|
|
|
|
|
|
|
|
t->ping_state.pings_before_data_required = |
|
|
|
|
t->ping_policy.max_pings_without_data; |
|
|
|
|
t->ping_state.is_delayed_ping_timer_set = false; |
|
|
|
|