-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update grpc to 1.62.0 #152
Changes from 5 commits
b456683
b637f80
1fb7e04
ea63148
d53eeb2
6b7b96b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,8 +27,8 @@ namespace cli | |
|
||
// Will print primitive fields regardless of their values. So e.g. an int32 field set to 0 will not be omitted. | ||
printOptions.always_print_primitive_fields = true; | ||
google::protobuf::util::Status status = google::protobuf::util::MessageToJsonString(f_message, &resultString, printOptions); | ||
|
||
auto status = google::protobuf::util::MessageToJsonString(f_message, &resultString, printOptions); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. const is your friend ;-) |
||
if(not status.ok()) | ||
{ | ||
resultString = std::string("Json encoding of Message failed: ") + status.ToString(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,7 +56,7 @@ std::vector<std::unique_ptr<google::protobuf::Message>> MessageParserJson::parse | |
buffer << source->rdbuf(); | ||
std::string fileContent = buffer.str(); | ||
auto status = google::protobuf::util::JsonStringToMessage( | ||
google::protobuf::StringPiece(fileContent), | ||
fileContent, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually you don't need a temporay ( |
||
message.get(), | ||
google::protobuf::util::JsonParseOptions()); | ||
if(not status.ok()) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,7 @@ Possible Candidates: | |
127.0.0.1 examples.StreamingRpcs (uni- and bi-directional streams) | ||
127.0.0.1 examples.StatusHandling (gRPC error handling) | ||
/^127.0.0.1 grpc.reflection.*$ | ||
/^127.0.0.1 grpc.reflection.*$ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in latest version, grpc server adds two reflection services (one stable and one alpha) |
||
#END_TEST | ||
|
||
#START_TEST complete rpcTimeout | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -200,9 +200,7 @@ RPC succeeded :D | |
|
||
#START_TEST json_input_stdin_malformed | ||
cat @@testResources@@/duplicateEverything1d_malformed.json | @@CMD@@ --disableCache --jsonInput=- 127.0.0.1 examples.NestedTypeRpcs duplicateEverything1d | ||
Warning: Failed to parse JSON file '-': INVALID_ARGUMENT:Unexpected end of string. Expected , or } after key:value pair. | ||
|
||
^ | ||
/Warning: Failed to parse JSON file '-': .* | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. protobuf error message changed slightly. made the test more flexible |
||
Error parsing method arguments -> aborting the call :-( | ||
#END_TEST | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
#include <optional> | ||
// END MODIFIED | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I took the most recent |
||
#include <cmath> | ||
#include <iostream> | ||
#include <utility> | ||
|
||
|
@@ -37,34 +38,29 @@ | |
#include <grpcpp/client_context.h> | ||
#include <grpcpp/support/byte_buffer.h> | ||
|
||
// MODIFIED by IBM (Rainer Schoenberger) | ||
// original: #include "src/core/lib/gprpp/crash.h" | ||
// END MODIFIED | ||
|
||
namespace grpc { | ||
namespace testing { | ||
namespace { | ||
void* tag(int i) { return (void*)static_cast<intptr_t>(i); } | ||
void* tag(intptr_t t) { return reinterpret_cast<void*>(t); } | ||
} // namespace | ||
|
||
Status CliCall::Call(std::shared_ptr<grpc::Channel> channel, | ||
const grpc::string& method, const grpc::string& request, | ||
grpc::string* response, | ||
const OutgoingMetadataContainer& metadata, | ||
Status CliCall::Call(const std::string& request, std::string* response, | ||
IncomingMetadataContainer* server_initial_metadata, | ||
IncomingMetadataContainer* server_trailing_metadata) { | ||
// MODIFIED by IBM (Anna Riesch) | ||
// original: no deadline | ||
std::optional<std::chrono::time_point<std::chrono::system_clock>> deadline; | ||
deadline = std::nullopt; | ||
CliCall call(std::move(channel), method, metadata, deadline); | ||
// END MODIFIED | ||
call.Write(request); | ||
call.WritesDone(); | ||
if (!call.Read(response, server_initial_metadata)) { | ||
Write(request); | ||
WritesDone(); | ||
if (!Read(response, server_initial_metadata)) { | ||
fprintf(stderr, "Failed to read response.\n"); | ||
} | ||
return call.Finish(server_trailing_metadata); | ||
return Finish(server_trailing_metadata); | ||
} | ||
|
||
CliCall::CliCall(const std::shared_ptr<grpc::Channel>& channel, | ||
const grpc::string& method, | ||
const std::string& method, | ||
const OutgoingMetadataContainer& metadata, | ||
// MODIFIED by IBM (Anna Riesch) | ||
// original: no argument "deadline" | ||
|
@@ -101,19 +97,19 @@ CliCall::~CliCall() { | |
gpr_mu_destroy(&write_mu_); | ||
} | ||
|
||
void CliCall::Write(const grpc::string& request) { | ||
void CliCall::Write(const std::string& request) { | ||
void* got_tag; | ||
bool ok; | ||
|
||
gpr_slice s = gpr_slice_from_copied_buffer(request.data(), request.size()); | ||
grpc_slice s = grpc_slice_from_copied_buffer(request.data(), request.size()); | ||
grpc::Slice req_slice(s, grpc::Slice::STEAL_REF); | ||
grpc::ByteBuffer send_buffer(&req_slice, 1); | ||
call_->Write(send_buffer, tag(2)); | ||
cq_.Next(&got_tag, &ok); | ||
GPR_ASSERT(ok); | ||
} | ||
|
||
bool CliCall::Read(grpc::string* response, | ||
bool CliCall::Read(std::string* response, | ||
IncomingMetadataContainer* server_initial_metadata) { | ||
void* got_tag; | ||
bool ok; | ||
|
@@ -147,7 +143,7 @@ void CliCall::WritesDone() { | |
GPR_ASSERT(ok); | ||
} | ||
|
||
void CliCall::WriteAndWait(const grpc::string& request) { | ||
void CliCall::WriteAndWait(const std::string& request) { | ||
grpc::Slice req_slice(request); | ||
grpc::ByteBuffer send_buffer(&req_slice, 1); | ||
|
||
|
@@ -171,8 +167,7 @@ void CliCall::WritesDoneAndWait() { | |
} | ||
|
||
bool CliCall::ReadAndMaybeNotifyWrite( | ||
grpc::string* response, | ||
IncomingMetadataContainer* server_initial_metadata) { | ||
std::string* response, IncomingMetadataContainer* server_initial_metadata) { | ||
void* got_tag; | ||
bool ok; | ||
grpc::ByteBuffer recv_buffer; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A build warning was given to set this. So setting here.