diff options
author | Julien Boeuf <jboeuf@google.com> | 2015-08-26 11:19:10 -0700 |
---|---|---|
committer | Julien Boeuf <jboeuf@google.com> | 2015-08-26 11:19:10 -0700 |
commit | 5b3516e2c5c3c6878d28cd19db73d5572851e6b9 (patch) | |
tree | a34bde8ab374f35f5a6a6a4cdbdf741076dbd3fa /src/cpp/proto/proto_utils.cc | |
parent | 9a8d0d3eaf8ccd1c3a6e27f1f8bbeeee85e64345 (diff) | |
parent | 1f1919c8cfc61cd9af288cd1585b38b9c3511e1f (diff) |
Merge branch 'master' of github.com:grpc/grpc into cpp_auth_md_processor
Diffstat (limited to 'src/cpp/proto/proto_utils.cc')
-rw-r--r-- | src/cpp/proto/proto_utils.cc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/cpp/proto/proto_utils.cc b/src/cpp/proto/proto_utils.cc index 63f4a3a0bc..be84c222a0 100644 --- a/src/cpp/proto/proto_utils.cc +++ b/src/cpp/proto/proto_utils.cc @@ -32,7 +32,6 @@ */ #include <grpc++/impl/proto_utils.h> -#include <grpc++/config.h> #include <grpc/grpc.h> #include <grpc/byte_buffer.h> @@ -40,6 +39,7 @@ #include <grpc/support/slice.h> #include <grpc/support/slice_buffer.h> #include <grpc/support/port_platform.h> +#include <grpc++/support/config.h> const int kMaxBufferLength = 8192; @@ -154,18 +154,18 @@ class GrpcBufferReader GRPC_FINAL namespace grpc { -Status SerializeProto(const grpc::protobuf::Message& msg, grpc_byte_buffer** bp) { +Status SerializeProto(const grpc::protobuf::Message& msg, + grpc_byte_buffer** bp) { GrpcBufferWriter writer(bp); return msg.SerializeToZeroCopyStream(&writer) ? Status::OK - : Status(StatusCode::INVALID_ARGUMENT, - "Failed to serialize message"); + : Status(StatusCode::INTERNAL, "Failed to serialize message"); } Status DeserializeProto(grpc_byte_buffer* buffer, grpc::protobuf::Message* msg, int max_message_size) { if (!buffer) { - return Status(StatusCode::INVALID_ARGUMENT, "No payload"); + return Status(StatusCode::INTERNAL, "No payload"); } GrpcBufferReader reader(buffer); ::grpc::protobuf::io::CodedInputStream decoder(&reader); @@ -173,11 +173,10 @@ Status DeserializeProto(grpc_byte_buffer* buffer, grpc::protobuf::Message* msg, decoder.SetTotalBytesLimit(max_message_size, max_message_size); } if (!msg->ParseFromCodedStream(&decoder)) { - return Status(StatusCode::INVALID_ARGUMENT, - msg->InitializationErrorString()); + return Status(StatusCode::INTERNAL, msg->InitializationErrorString()); } if (!decoder.ConsumedEntireMessage()) { - return Status(StatusCode::INVALID_ARGUMENT, "Did not read entire message"); + return Status(StatusCode::INTERNAL, "Did not read entire message"); } return Status::OK; } |