|
|
@ -79,7 +79,9 @@ static int g_default_server_keepalive_time_ms = |
|
|
|
DEFAULT_SERVER_KEEPALIVE_TIME_MS; |
|
|
|
DEFAULT_SERVER_KEEPALIVE_TIME_MS; |
|
|
|
static int g_default_server_keepalive_timeout_ms = |
|
|
|
static int g_default_server_keepalive_timeout_ms = |
|
|
|
DEFAULT_SERVER_KEEPALIVE_TIMEOUT_MS; |
|
|
|
DEFAULT_SERVER_KEEPALIVE_TIMEOUT_MS; |
|
|
|
static bool g_default_keepalive_permit_without_calls = |
|
|
|
static bool g_default_client_keepalive_permit_without_calls = |
|
|
|
|
|
|
|
DEFAULT_KEEPALIVE_PERMIT_WITHOUT_CALLS; |
|
|
|
|
|
|
|
static bool g_default_server_keepalive_permit_without_calls = |
|
|
|
DEFAULT_KEEPALIVE_PERMIT_WITHOUT_CALLS; |
|
|
|
DEFAULT_KEEPALIVE_PERMIT_WITHOUT_CALLS; |
|
|
|
|
|
|
|
|
|
|
|
static int g_default_min_sent_ping_interval_without_data_ms = |
|
|
|
static int g_default_min_sent_ping_interval_without_data_ms = |
|
|
@ -343,6 +345,8 @@ static void init_transport(grpc_chttp2_transport* t, |
|
|
|
t->keepalive_timeout = g_default_client_keepalive_timeout_ms == INT_MAX |
|
|
|
t->keepalive_timeout = g_default_client_keepalive_timeout_ms == INT_MAX |
|
|
|
? GRPC_MILLIS_INF_FUTURE |
|
|
|
? GRPC_MILLIS_INF_FUTURE |
|
|
|
: g_default_client_keepalive_timeout_ms; |
|
|
|
: g_default_client_keepalive_timeout_ms; |
|
|
|
|
|
|
|
t->keepalive_permit_without_calls = |
|
|
|
|
|
|
|
g_default_client_keepalive_permit_without_calls; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
t->keepalive_time = g_default_server_keepalive_time_ms == INT_MAX |
|
|
|
t->keepalive_time = g_default_server_keepalive_time_ms == INT_MAX |
|
|
|
? GRPC_MILLIS_INF_FUTURE |
|
|
|
? GRPC_MILLIS_INF_FUTURE |
|
|
@ -350,8 +354,9 @@ static void init_transport(grpc_chttp2_transport* t, |
|
|
|
t->keepalive_timeout = g_default_server_keepalive_timeout_ms == INT_MAX |
|
|
|
t->keepalive_timeout = g_default_server_keepalive_timeout_ms == INT_MAX |
|
|
|
? GRPC_MILLIS_INF_FUTURE |
|
|
|
? GRPC_MILLIS_INF_FUTURE |
|
|
|
: g_default_server_keepalive_timeout_ms; |
|
|
|
: g_default_server_keepalive_timeout_ms; |
|
|
|
|
|
|
|
t->keepalive_permit_without_calls = |
|
|
|
|
|
|
|
g_default_server_keepalive_permit_without_calls; |
|
|
|
} |
|
|
|
} |
|
|
|
t->keepalive_permit_without_calls = g_default_keepalive_permit_without_calls; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
t->opt_target = GRPC_CHTTP2_OPTIMIZE_FOR_LATENCY; |
|
|
|
t->opt_target = GRPC_CHTTP2_OPTIMIZE_FOR_LATENCY; |
|
|
|
|
|
|
|
|
|
|
@ -2521,7 +2526,9 @@ void grpc_chttp2_config_default_keepalive_args(grpc_channel_args* args, |
|
|
|
for (i = 0; i < args->num_args; i++) { |
|
|
|
for (i = 0; i < args->num_args; i++) { |
|
|
|
if (0 == strcmp(args->args[i].key, GRPC_ARG_KEEPALIVE_TIME_MS)) { |
|
|
|
if (0 == strcmp(args->args[i].key, GRPC_ARG_KEEPALIVE_TIME_MS)) { |
|
|
|
const int value = grpc_channel_arg_get_integer( |
|
|
|
const int value = grpc_channel_arg_get_integer( |
|
|
|
&args->args[i], {g_default_client_keepalive_time_ms, 1, INT_MAX}); |
|
|
|
&args->args[i], {is_client ? g_default_client_keepalive_time_ms |
|
|
|
|
|
|
|
: g_default_server_keepalive_time_ms, |
|
|
|
|
|
|
|
1, INT_MAX}); |
|
|
|
if (is_client) { |
|
|
|
if (is_client) { |
|
|
|
g_default_client_keepalive_time_ms = value; |
|
|
|
g_default_client_keepalive_time_ms = value; |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -2530,8 +2537,9 @@ void grpc_chttp2_config_default_keepalive_args(grpc_channel_args* args, |
|
|
|
} else if (0 == |
|
|
|
} else if (0 == |
|
|
|
strcmp(args->args[i].key, GRPC_ARG_KEEPALIVE_TIMEOUT_MS)) { |
|
|
|
strcmp(args->args[i].key, GRPC_ARG_KEEPALIVE_TIMEOUT_MS)) { |
|
|
|
const int value = grpc_channel_arg_get_integer( |
|
|
|
const int value = grpc_channel_arg_get_integer( |
|
|
|
&args->args[i], |
|
|
|
&args->args[i], {is_client ? g_default_client_keepalive_timeout_ms |
|
|
|
{g_default_client_keepalive_timeout_ms, 0, INT_MAX}); |
|
|
|
: g_default_server_keepalive_timeout_ms, |
|
|
|
|
|
|
|
0, INT_MAX}); |
|
|
|
if (is_client) { |
|
|
|
if (is_client) { |
|
|
|
g_default_client_keepalive_timeout_ms = value; |
|
|
|
g_default_client_keepalive_timeout_ms = value; |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -2539,10 +2547,16 @@ void grpc_chttp2_config_default_keepalive_args(grpc_channel_args* args, |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (0 == strcmp(args->args[i].key, |
|
|
|
} else if (0 == strcmp(args->args[i].key, |
|
|
|
GRPC_ARG_KEEPALIVE_PERMIT_WITHOUT_CALLS)) { |
|
|
|
GRPC_ARG_KEEPALIVE_PERMIT_WITHOUT_CALLS)) { |
|
|
|
g_default_keepalive_permit_without_calls = |
|
|
|
const bool value = (uint32_t)grpc_channel_arg_get_integer( |
|
|
|
(uint32_t)grpc_channel_arg_get_integer( |
|
|
|
&args->args[i], |
|
|
|
&args->args[i], |
|
|
|
{is_client ? g_default_client_keepalive_permit_without_calls |
|
|
|
{g_default_keepalive_permit_without_calls, 0, 1}); |
|
|
|
: g_default_server_keepalive_timeout_ms, |
|
|
|
|
|
|
|
0, 1}); |
|
|
|
|
|
|
|
if (is_client) { |
|
|
|
|
|
|
|
g_default_client_keepalive_permit_without_calls = value; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
g_default_server_keepalive_permit_without_calls = value; |
|
|
|
|
|
|
|
} |
|
|
|
} else if (0 == |
|
|
|
} else if (0 == |
|
|
|
strcmp(args->args[i].key, GRPC_ARG_HTTP2_MAX_PING_STRIKES)) { |
|
|
|
strcmp(args->args[i].key, GRPC_ARG_HTTP2_MAX_PING_STRIKES)) { |
|
|
|
g_default_max_ping_strikes = grpc_channel_arg_get_integer( |
|
|
|
g_default_max_ping_strikes = grpc_channel_arg_get_integer( |
|
|
|