diff options
author | Noah Eisen <ncteisen@google.com> | 2016-10-12 15:32:42 -0700 |
---|---|---|
committer | Noah Eisen <ncteisen@google.com> | 2016-10-12 15:32:42 -0700 |
commit | f8ffbf62a2a44f152c2d88b388fe67de62cc1051 (patch) | |
tree | bb1cd193607f6e87c80947a0af0ecf9f71aeb291 | |
parent | 002f41ed28e687ef954b5837c66f27c32f34634e (diff) |
also reverted interop server, since mark had already made the changes I did in an un merged pull request
-rw-r--r-- | test/cpp/interop/interop_server.cc | 50 |
1 files changed, 10 insertions, 40 deletions
diff --git a/test/cpp/interop/interop_server.cc b/test/cpp/interop/interop_server.cc index e0016148e8..c05eb5d146 100644 --- a/test/cpp/interop/interop_server.cc +++ b/test/cpp/interop/interop_server.cc @@ -47,7 +47,6 @@ #include <grpc/support/log.h> #include <grpc/support/useful.h> -#include "src/core/lib/support/string.h" #include "src/core/lib/transport/byte_stream.h" #include "src/proto/grpc/testing/empty.grpc.pb.h" #include "src/proto/grpc/testing/messages.grpc.pb.h" @@ -83,8 +82,6 @@ const char kEchoInitialMetadataKey[] = "x-grpc-test-echo-initial"; const char kEchoTrailingBinMetadataKey[] = "x-grpc-test-echo-trailing-bin"; const char kEchoUserAgentKey[] = "x-grpc-test-echo-useragent"; -namespace { - void MaybeEchoMetadata(ServerContext* context) { const auto& client_metadata = context->client_metadata(); GPR_ASSERT(client_metadata.count(kEchoInitialMetadataKey) <= 1); @@ -148,28 +145,6 @@ bool CheckExpectedCompression(const ServerContext& context, return true; } -Status RequestedStatusOrOk(const SimpleRequest* request) { - if (request->has_response_status()) { - return Status( - static_cast<grpc::StatusCode>(request->response_status().code()), - request->response_status().message()); - } else { - return Status::OK; - } -} - -Status RequestedStatusOrOk(const StreamingOutputCallRequest* request) { - if (request->has_response_status()) { - return Status( - static_cast<grpc::StatusCode>(request->response_status().code()), - request->response_status().message()); - } else { - return Status::OK; - } -} - -} // anonomous namespace - class TestServiceImpl : public TestService::Service { public: Status EmptyCall(ServerContext* context, const grpc::testing::Empty* request, @@ -178,17 +153,6 @@ class TestServiceImpl : public TestService::Service { return Status::OK; } - // Response contains current timestamp. We ignore everything in the request. - Status CacheableUnaryCall(ServerContext* context, - const SimpleRequest* request, - SimpleResponse* response) { - gpr_timespec ts = gpr_now(GPR_CLOCK_PRECISE); - std::string timestamp = std::to_string((long long unsigned)ts.tv_nsec); - response->mutable_payload()->set_body(timestamp.c_str(), timestamp.size()); - context->AddInitialMetadata("cache-control", "max-age=60, public"); - return Status::OK; - } - Status UnaryCall(ServerContext* context, const SimpleRequest* request, SimpleResponse* response) { MaybeEchoMetadata(context); @@ -215,7 +179,13 @@ class TestServiceImpl : public TestService::Service { } } - return RequestedStatusOrOk(request); + if (request->has_response_status()) { + return Status( + static_cast<grpc::StatusCode>(request->response_status().code()), + request->response_status().message()); + } + + return Status::OK; } Status StreamingOutputCall( @@ -253,7 +223,7 @@ class TestServiceImpl : public TestService::Service { write_success = writer->Write(response, wopts); } if (write_success) { - return RequestedStatusOrOk(request); + return Status::OK; } else { return Status(grpc::StatusCode::INTERNAL, "Error writing response."); } @@ -303,7 +273,7 @@ class TestServiceImpl : public TestService::Service { } } if (write_success) { - return RequestedStatusOrOk(&request); + return Status::OK; } else { return Status(grpc::StatusCode::INTERNAL, "Error writing response."); } @@ -332,7 +302,7 @@ class TestServiceImpl : public TestService::Service { write_success = stream->Write(response); } if (write_success) { - return RequestedStatusOrOk(&request); + return Status::OK; } else { return Status(grpc::StatusCode::INTERNAL, "Error writing response."); } |