|
|
|
@ -91,7 +91,6 @@ static void end_test(grpc_end2end_test_fixture* f) { |
|
|
|
|
|
|
|
|
|
/* Client sends a request, server replies with a payload, then waits for the
|
|
|
|
|
keepalive watchdog timeouts before returning status. */ |
|
|
|
|
#if 0 |
|
|
|
|
static void test_keepalive_timeout(grpc_end2end_test_config config) { |
|
|
|
|
grpc_call* c; |
|
|
|
|
grpc_call* s; |
|
|
|
@ -220,15 +219,20 @@ static void test_keepalive_timeout(grpc_end2end_test_config config) { |
|
|
|
|
end_test(&f); |
|
|
|
|
config.tear_down_data(&f); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
/* Verify that reads reset the keepalive ping timer. The client sends 30 pings
|
|
|
|
|
* with a sleep of 10ms in between. It has a configured keepalive timer of |
|
|
|
|
* 200ms. In the success case, each ping ack should reset the keepalive timer so |
|
|
|
|
* that the keepalive ping is never sent. */ |
|
|
|
|
static void test_read_delays_keepalive(grpc_end2end_test_config config) { |
|
|
|
|
gpr_log(GPR_ERROR, "ura"); |
|
|
|
|
const int kPingIntervalMS = 5; |
|
|
|
|
char* poller = gpr_getenv("GRPC_POLL_STRATEGY"); |
|
|
|
|
/* It is hard to get the timing right for the polling engines poll and poll-cv */ |
|
|
|
|
if(poller != nullptr && (0 == strcmp(poller, "poll-cv") || 0 == strcmp(poller, "poll"))) { |
|
|
|
|
gpr_free(poller); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
gpr_free(poller); |
|
|
|
|
const int kPingIntervalMS = 100; |
|
|
|
|
grpc_arg keepalive_arg_elems[3]; |
|
|
|
|
keepalive_arg_elems[0].type = GRPC_ARG_INTEGER; |
|
|
|
|
keepalive_arg_elems[0].key = const_cast<char*>(GRPC_ARG_KEEPALIVE_TIME_MS); |
|
|
|
@ -377,9 +381,7 @@ static void test_read_delays_keepalive(grpc_end2end_test_config config) { |
|
|
|
|
grpc_byte_buffer_destroy(request_payload_recv); |
|
|
|
|
grpc_byte_buffer_destroy(response_payload_recv); |
|
|
|
|
/* Sleep for a short interval to check if the client sends any pings */ |
|
|
|
|
gpr_log(GPR_ERROR, "before sleep"); |
|
|
|
|
gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(kPingIntervalMS)); |
|
|
|
|
gpr_log(GPR_ERROR, "after sleep"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
grpc_slice_unref(request_payload_slice); |
|
|
|
@ -431,7 +433,7 @@ static void test_read_delays_keepalive(grpc_end2end_test_config config) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void keepalive_timeout(grpc_end2end_test_config config) { |
|
|
|
|
// test_keepalive_timeout(config);
|
|
|
|
|
test_keepalive_timeout(config); |
|
|
|
|
test_read_delays_keepalive(config); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|