Merge pull request #19920 from soheilhy/protobuf

Directly use the ZeroCopyInputStream for grpc::GenericDeserialize.
reviewable/pr19713/r2
Soheil Hassas Yeganeh 6 years ago committed by GitHub
commit ae7b126de6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      include/grpcpp/impl/codegen/proto_utils.h

@ -83,14 +83,9 @@ Status GenericDeserialize(ByteBuffer* buffer,
if (!reader.status().ok()) {
return reader.status();
}
::grpc::protobuf::io::CodedInputStream decoder(&reader);
decoder.SetTotalBytesLimit(INT_MAX, INT_MAX);
if (!msg->ParseFromCodedStream(&decoder)) {
if (!msg->ParseFromZeroCopyStream(&reader)) {
result = Status(StatusCode::INTERNAL, msg->InitializationErrorString());
}
if (!decoder.ConsumedEntireMessage()) {
result = Status(StatusCode::INTERNAL, "Did not read entire message");
}
}
buffer->Clear();
return result;

Loading…
Cancel
Save