Merge pull request #246 from yang-g/master

Move to new Status API
pull/3109/head
Nicolas Noble 10 years ago
commit 363b6cd786
  1. 2
      cpp/helloworld/greeter_async_client.cc
  2. 2
      cpp/helloworld/greeter_client.cc
  3. 8
      cpp/route_guide/route_guide_client.cc

@ -79,7 +79,7 @@ class GreeterClient {
GPR_ASSERT(ok); GPR_ASSERT(ok);
GPR_ASSERT(got_tag == (void*)1); GPR_ASSERT(got_tag == (void*)1);
if (status.IsOk()) { if (status.ok()) {
return reply.message(); return reply.message();
} else { } else {
return "Rpc failed"; return "Rpc failed";

@ -64,7 +64,7 @@ class GreeterClient {
ClientContext context; ClientContext context;
Status status = stub_->SayHello(&context, request, &reply); Status status = stub_->SayHello(&context, request, &reply);
if (status.IsOk()) { if (status.ok()) {
return reply.message(); return reply.message();
} else { } else {
return "Rpc failed"; return "Rpc failed";

@ -124,7 +124,7 @@ class RouteGuideClient {
<< feature.location().longitude()/kCoordFactor_ << std::endl; << feature.location().longitude()/kCoordFactor_ << std::endl;
} }
Status status = reader->Finish(); Status status = reader->Finish();
if (status.IsOk()) { if (status.ok()) {
std::cout << "ListFeatures rpc succeeded." << std::endl; std::cout << "ListFeatures rpc succeeded." << std::endl;
} else { } else {
std::cout << "ListFeatures rpc failed." << std::endl; std::cout << "ListFeatures rpc failed." << std::endl;
@ -160,7 +160,7 @@ class RouteGuideClient {
} }
writer->WritesDone(); writer->WritesDone();
Status status = writer->Finish(); Status status = writer->Finish();
if (status.IsOk()) { if (status.ok()) {
std::cout << "Finished trip with " << stats.point_count() << " points\n" std::cout << "Finished trip with " << stats.point_count() << " points\n"
<< "Passed " << stats.feature_count() << " features\n" << "Passed " << stats.feature_count() << " features\n"
<< "Travelled " << stats.distance() << " meters\n" << "Travelled " << stats.distance() << " meters\n"
@ -200,7 +200,7 @@ class RouteGuideClient {
} }
writer.join(); writer.join();
Status status = stream->Finish(); Status status = stream->Finish();
if (!status.IsOk()) { if (!status.ok()) {
std::cout << "RouteChat rpc failed." << std::endl; std::cout << "RouteChat rpc failed." << std::endl;
} }
} }
@ -210,7 +210,7 @@ class RouteGuideClient {
bool GetOneFeature(const Point& point, Feature* feature) { bool GetOneFeature(const Point& point, Feature* feature) {
ClientContext context; ClientContext context;
Status status = stub_->GetFeature(&context, point, feature); Status status = stub_->GetFeature(&context, point, feature);
if (!status.IsOk()) { if (!status.ok()) {
std::cout << "GetFeature rpc failed." << std::endl; std::cout << "GetFeature rpc failed." << std::endl;
return false; return false;
} }

Loading…
Cancel
Save