diff --git a/cpp/helloworld/greeter_async_client.cc b/cpp/helloworld/greeter_async_client.cc index 5fa6ec6..b131005 100644 --- a/cpp/helloworld/greeter_async_client.cc +++ b/cpp/helloworld/greeter_async_client.cc @@ -90,22 +90,16 @@ class GreeterClient { } } - void Shutdown() { stub_.reset(); } - private: std::unique_ptr 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; } diff --git a/cpp/helloworld/greeter_async_server.cc b/cpp/helloworld/greeter_async_server.cc index 47110a7..2e5343b 100644 --- a/cpp/helloworld/greeter_async_server.cc +++ b/cpp/helloworld/greeter_async_server.cc @@ -131,11 +131,8 @@ class ServerImpl final { }; int main(int argc, char** argv) { - grpc_init(); - ServerImpl server; server.Run(); - grpc_shutdown(); return 0; } diff --git a/cpp/helloworld/greeter_client.cc b/cpp/helloworld/greeter_client.cc index 4776cf9..c0aec16 100644 --- a/cpp/helloworld/greeter_client.cc +++ b/cpp/helloworld/greeter_client.cc @@ -71,15 +71,11 @@ class GreeterClient { } } - void Shutdown() { stub_.reset(); } - private: std::unique_ptr 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; } diff --git a/cpp/helloworld/greeter_server.cc b/cpp/helloworld/greeter_server.cc index a090075..e40bf1b 100644 --- a/cpp/helloworld/greeter_server.cc +++ b/cpp/helloworld/greeter_server.cc @@ -73,10 +73,7 @@ void RunServer() { } int main(int argc, char** argv) { - grpc_init(); - RunServer(); - grpc_shutdown(); return 0; }