diff options
Diffstat (limited to 'test/cpp/qps/server_sync.cc')
-rw-r--r-- | test/cpp/qps/server_sync.cc | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/test/cpp/qps/server_sync.cc b/test/cpp/qps/server_sync.cc index 3e15fb61c0..2770233a7c 100644 --- a/test/cpp/qps/server_sync.cc +++ b/test/cpp/qps/server_sync.cc @@ -47,8 +47,7 @@ #include <grpc++/status.h> #include <grpc++/stream.h> #include "src/cpp/server/thread_pool.h" -#include "test/core/util/grpc_profiler.h" -#include "test/cpp/qps/qpstest.pb.h" +#include "test/cpp/qps/qpstest.grpc.pb.h" #include "test/cpp/qps/server.h" #include "test/cpp/qps/timer.h" @@ -62,7 +61,7 @@ class TestServiceImpl GRPC_FINAL : public TestService::Service { public: Status UnaryCall(ServerContext* context, const SimpleRequest* request, SimpleResponse* response) GRPC_OVERRIDE { - if (request->has_response_size() && request->response_size() > 0) { + if (request->response_size() > 0) { if (!Server::SetPayload(request->response_type(), request->response_size(), response->mutable_payload())) { @@ -71,6 +70,23 @@ class TestServiceImpl GRPC_FINAL : public TestService::Service { } return Status::OK; } + Status StreamingCall(ServerContext *context, + ServerReaderWriter<SimpleResponse, SimpleRequest>* + stream) GRPC_OVERRIDE { + SimpleRequest request; + while (stream->Read(&request)) { + SimpleResponse response; + if (request.response_size() > 0) { + if (!Server::SetPayload(request.response_type(), + request.response_size(), + response.mutable_payload())) { + return Status(grpc::StatusCode::INTERNAL, "Error creating payload."); + } + } + stream->Write(response); + } + return Status::OK; + } }; class SynchronousServer GRPC_FINAL : public grpc::testing::Server { |