From 8c48a2a196e93f69e124464037563eb49a0341d5 Mon Sep 17 00:00:00 2001 From: Julien Boeuf <jboeuf@google.com> Date: Sat, 17 Oct 2015 22:23:02 -0700 Subject: [PATCH] Fixing cpp examples. --- examples/cpp/cpptutorial.md | 2 +- examples/cpp/helloworld/README.md | 2 +- examples/cpp/helloworld/greeter_async_client.cc | 6 +++--- examples/cpp/helloworld/greeter_client.cc | 6 +++--- examples/cpp/route_guide/route_guide_client.cc | 3 ++- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/examples/cpp/cpptutorial.md b/examples/cpp/cpptutorial.md index 78de014f97..cd1cddb111 100644 --- a/examples/cpp/cpptutorial.md +++ b/examples/cpp/cpptutorial.md @@ -245,7 +245,7 @@ To call service methods, we first need to create a *stub*. First we need to create a gRPC *channel* for our stub, specifying the server address and port we want to connect to without SSL: ```cpp -grpc::CreateChannel("localhost:50051", grpc::InsecureCredentials()); +grpc::CreateChannel("localhost:50051", grpc::InsecureChannelCredentials()); ``` Now we can use the channel to create our stub using the `NewStub` method provided in the `RouteGuide` class we generated from our .proto. diff --git a/examples/cpp/helloworld/README.md b/examples/cpp/helloworld/README.md index b16c084583..7a7194d111 100644 --- a/examples/cpp/helloworld/README.md +++ b/examples/cpp/helloworld/README.md @@ -94,7 +94,7 @@ $ protoc -I ../../protos/ --cpp_out=. ../../protos/helloworld.proto arguments as follows ``` - auto channel = CreateChannel("localhost:50051", InsecureCredentials()); + auto channel = CreateChannel("localhost:50051", InsecureChannelCredentials()); ``` - Create a stub. A stub implements the rpc methods of a service and in the diff --git a/examples/cpp/helloworld/greeter_async_client.cc b/examples/cpp/helloworld/greeter_async_client.cc index 923c8ffa74..35014267fe 100644 --- a/examples/cpp/helloworld/greeter_async_client.cc +++ b/examples/cpp/helloworld/greeter_async_client.cc @@ -114,9 +114,9 @@ int main(int argc, char** argv) { // Instantiate the client. It requires a channel, out of which the actual RPCs // are created. This channel models a connection to an endpoint (in this case, // localhost at port 50051). We indicate that the channel isn't authenticated - // (use of InsecureCredentials()). - GreeterClient greeter( - grpc::CreateChannel("localhost:50051", grpc::InsecureCredentials())); + // (use of InsecureChannelCredentials()). + GreeterClient greeter(grpc::CreateChannel( + "localhost:50051", grpc::InsecureChannelCredentials())); std::string user("world"); std::string reply = greeter.SayHello(user); // The actual RPC call! std::cout << "Greeter received: " << reply << std::endl; diff --git a/examples/cpp/helloworld/greeter_client.cc b/examples/cpp/helloworld/greeter_client.cc index 6cd8353a9f..bf3b63cb57 100644 --- a/examples/cpp/helloworld/greeter_client.cc +++ b/examples/cpp/helloworld/greeter_client.cc @@ -84,9 +84,9 @@ int main(int argc, char** argv) { // Instantiate the client. It requires a channel, out of which the actual RPCs // are created. This channel models a connection to an endpoint (in this case, // localhost at port 50051). We indicate that the channel isn't authenticated - // (use of InsecureCredentials()). - GreeterClient greeter( - grpc::CreateChannel("localhost:50051", grpc::InsecureCredentials())); + // (use of InsecureChannelCredentials()). + GreeterClient greeter(grpc::CreateChannel( + "localhost:50051", grpc::InsecureChannelCredentials())); std::string user("world"); std::string reply = greeter.SayHello(user); std::cout << "Greeter received: " << reply << std::endl; diff --git a/examples/cpp/route_guide/route_guide_client.cc b/examples/cpp/route_guide/route_guide_client.cc index 85173a3932..b9abe72a5b 100644 --- a/examples/cpp/route_guide/route_guide_client.cc +++ b/examples/cpp/route_guide/route_guide_client.cc @@ -234,7 +234,8 @@ int main(int argc, char** argv) { // Expect only arg: --db_path=path/to/route_guide_db.json. std::string db = routeguide::GetDbFileContent(argc, argv); RouteGuideClient guide( - grpc::CreateChannel("localhost:50051", grpc::InsecureCredentials()), + grpc::CreateChannel("localhost:50051", + grpc::InsecureChannelCredentials()), db); std::cout << "-------------- GetFeature --------------" << std::endl; -- GitLab