diff options
author | David Garcia Quintas <dgq@google.com> | 2016-06-16 18:43:19 -0700 |
---|---|---|
committer | David Garcia Quintas <dgq@google.com> | 2016-06-16 18:43:19 -0700 |
commit | 8375c0daeabcb1aa0b47da1d82fa71fd6eafcb33 (patch) | |
tree | 3f8a688302621aa527a253675a488cbf8335659e /test/cpp/interop | |
parent | 909dd6ec8bf41d16073d98b891c8178d5cbd0936 (diff) | |
parent | 69170755b8f16d7f2540e0bc060f67940e4b4158 (diff) |
Merge branch 'master' of github.com:grpc/grpc into simplify_compression_interop
Diffstat (limited to 'test/cpp/interop')
-rw-r--r-- | test/cpp/interop/interop_server.cc | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/test/cpp/interop/interop_server.cc b/test/cpp/interop/interop_server.cc index 8c5c0e24e1..f0a182f230 100644 --- a/test/cpp/interop/interop_server.cc +++ b/test/cpp/interop/interop_server.cc @@ -214,7 +214,15 @@ class TestServiceImpl : public TestService::Service { wopts.set_no_compression(); } // else, compression is already enabled via the context. } - write_success = writer->Write(response, wopts); + 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) { return Status::OK; @@ -255,6 +263,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); } } |