Merge pull request #197 from yang-g/master

Remove call sites of grpc_init/grpc_shutdown in examples as they are no longer needed.
pull/3109/head
Nicolas Noble 10 years ago
commit de7d962ce5
  1. 8
      cpp/helloworld/greeter_async_client.cc
  2. 3
      cpp/helloworld/greeter_async_server.cc
  3. 8
      cpp/helloworld/greeter_client.cc
  4. 3
      cpp/helloworld/greeter_server.cc
  5. 8
      cpp/route_guide/route_guide_client.cc
  6. 6
      cpp/route_guide/route_guide_server.cc

@ -90,22 +90,16 @@ class GreeterClient {
}
}
void Shutdown() { stub_.reset(); }
private:
std::unique_ptr<Greeter::Stub> stub_;
};
int main(int argc, char** argv) {
grpc_init();
GreeterClient greeter(grpc::CreateChannel(
"localhost:50051", grpc::InsecureCredentials(), ChannelArguments()));
std::string user("world");
std::string reply = greeter.SayHello(user);
std::cout << "Greeter received: " << reply << std::endl;
greeter.Shutdown();
grpc_shutdown();
return 0;
}

@ -131,11 +131,8 @@ class ServerImpl final {
};
int main(int argc, char** argv) {
grpc_init();
ServerImpl server;
server.Run();
grpc_shutdown();
return 0;
}

@ -71,15 +71,11 @@ class GreeterClient {
}
}
void Shutdown() { stub_.reset(); }
private:
std::unique_ptr<Greeter::Stub> stub_;
};
int main(int argc, char** argv) {
grpc_init();
GreeterClient greeter(
grpc::CreateChannel("localhost:50051", grpc::InsecureCredentials(),
ChannelArguments()));
@ -87,7 +83,5 @@ int main(int argc, char** argv) {
std::string reply = greeter.SayHello(user);
std::cout << "Greeter received: " << reply << std::endl;
greeter.Shutdown();
grpc_shutdown();
return 0;
}

@ -73,10 +73,7 @@ void RunServer() {
}
int main(int argc, char** argv) {
grpc_init();
RunServer();
grpc_shutdown();
return 0;
}

@ -205,8 +205,6 @@ class RouteGuideClient {
}
}
void Shutdown() { stub_.reset(); }
private:
bool GetOneFeature(const Point& point, Feature* feature) {
@ -238,8 +236,6 @@ class RouteGuideClient {
};
int main(int argc, char** argv) {
grpc_init();
// Expect only arg: --db_path=path/to/route_guide_db.json.
std::string db = examples::GetDbFileContent(argc, argv);
RouteGuideClient guide(
@ -256,7 +252,5 @@ int main(int argc, char** argv) {
std::cout << "-------------- RouteChat --------------" << std::endl;
guide.RouteChat();
guide.Shutdown();
grpc_shutdown();
return 0;
}

@ -111,7 +111,8 @@ class RouteGuideImpl final : public RouteGuide::Service {
return Status::OK;
}
Status ListFeatures(ServerContext* context, const examples::Rectangle* rectangle,
Status ListFeatures(ServerContext* context,
const examples::Rectangle* rectangle,
ServerWriter<Feature>* writer) override {
auto lo = rectangle->lo();
auto hi = rectangle->hi();
@ -195,12 +196,9 @@ void RunServer(const std::string& db_path) {
}
int main(int argc, char** argv) {
grpc_init();
// Expect only arg: --db_path=path/to/route_guide_db.json.
std::string db = examples::GetDbFileContent(argc, argv);
RunServer(db);
grpc_shutdown();
return 0;
}

Loading…
Cancel
Save