aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/interop
diff options
context:
space:
mode:
authorGravatar Vijay Pai <vpai@google.com>2016-06-17 13:41:38 -0700
committerGravatar Vijay Pai <vpai@google.com>2016-06-17 13:41:38 -0700
commitddf694cc62ec921da169b5abbf9ad56f827f2baa (patch)
treec92c695cee65a5de379fda2938aa7ecd52ee6cb5 /test/cpp/interop
parent6ab4788ae91c08a6b659e61773609c24d9deb305 (diff)
parent02db1e43240fbfb77e57c70d1d59e5bd6d537e4a (diff)
Merge branch 'master' into wheezy
Diffstat (limited to 'test/cpp/interop')
-rw-r--r--test/cpp/interop/server_main.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/cpp/interop/server_main.cc b/test/cpp/interop/server_main.cc
index bbedda14d2..062857f3d6 100644
--- a/test/cpp/interop/server_main.cc
+++ b/test/cpp/interop/server_main.cc
@@ -181,6 +181,14 @@ class TestServiceImpl : public TestService::Service {
response.mutable_payload())) {
return Status(grpc::StatusCode::INTERNAL, "Error creating payload.");
}
+ int time_us;
+ if ((time_us = request->response_parameters(i).interval_us()) > 0) {
+ // Sleep before response if needed
+ gpr_timespec sleep_time =
+ gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
+ gpr_time_from_micros(time_us, GPR_TIMESPAN));
+ gpr_sleep_until(sleep_time);
+ }
write_success = writer->Write(response);
}
if (write_success) {
@@ -218,6 +226,14 @@ class TestServiceImpl : public TestService::Service {
response.mutable_payload()->set_type(request.payload().type());
response.mutable_payload()->set_body(
grpc::string(request.response_parameters(0).size(), '\0'));
+ int time_us;
+ if ((time_us = request.response_parameters(0).interval_us()) > 0) {
+ // Sleep before response if needed
+ gpr_timespec sleep_time =
+ gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
+ gpr_time_from_micros(time_us, GPR_TIMESPAN));
+ gpr_sleep_until(sleep_time);
+ }
write_success = stream->Write(response);
}
}