proto3 required changes

pull/2603/head
David Garcia Quintas 9 years ago
parent 80dc66d8ab
commit 864d18650e
  1. 3
      test/cpp/interop/interop_client.cc
  2. 28
      test/cpp/interop/server.cc

@ -104,9 +104,6 @@ void InteropClient::PerformLargeUnary(SimpleRequest* request,
InteropClientContextInspector inspector(context);
// If the request doesn't already specify the response type, default to
// COMPRESSABLE.
if (!request->has_response_type()) {
request->set_response_type(PayloadType::COMPRESSABLE);
}
request->set_response_size(kLargeResponseSize);
grpc::string payload(kLargeRequestSize, '\0');
request->mutable_payload()->set_body(payload.c_str(), kLargeRequestSize);

@ -115,20 +115,18 @@ bool SetPayload(PayloadType type, int size, Payload* payload) {
template <typename RequestType>
void SetResponseCompression(ServerContext* context,
const RequestType& request) {
if (request.has_response_compression()) {
switch (request.response_compression()) {
case grpc::testing::NONE:
context->set_compression_algorithm(GRPC_COMPRESS_NONE);
break;
case grpc::testing::GZIP:
context->set_compression_algorithm(GRPC_COMPRESS_GZIP);
break;
case grpc::testing::DEFLATE:
context->set_compression_algorithm(GRPC_COMPRESS_DEFLATE);
break;
}
} else {
context->set_compression_algorithm(GRPC_COMPRESS_NONE);
switch (request.response_compression()) {
case grpc::testing::NONE:
context->set_compression_algorithm(GRPC_COMPRESS_NONE);
break;
case grpc::testing::GZIP:
context->set_compression_algorithm(GRPC_COMPRESS_GZIP);
break;
case grpc::testing::DEFLATE:
context->set_compression_algorithm(GRPC_COMPRESS_DEFLATE);
break;
default:
abort();
}
}
@ -142,7 +140,7 @@ class TestServiceImpl : public TestService::Service {
Status UnaryCall(ServerContext* context, const SimpleRequest* request,
SimpleResponse* response) {
SetResponseCompression(context, *request);
if (request->has_response_size() && request->response_size() > 0) {
if (request->response_size() > 0) {
if (!SetPayload(request->response_type(), request->response_size(),
response->mutable_payload())) {
return Status(grpc::StatusCode::INTERNAL, "Error creating payload.");

Loading…
Cancel
Save