aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/cpp')
-rw-r--r--examples/cpp/README.md2
-rw-r--r--examples/cpp/cpptutorial.md2
-rw-r--r--examples/cpp/helloworld/Makefile2
-rw-r--r--examples/cpp/helloworld/README.md2
-rw-r--r--examples/cpp/helloworld/greeter_async_client.cc4
-rw-r--r--examples/cpp/helloworld/greeter_async_server.cc4
6 files changed, 10 insertions, 6 deletions
diff --git a/examples/cpp/README.md b/examples/cpp/README.md
index d93cbacf7b..3fa7ad4c78 100644
--- a/examples/cpp/README.md
+++ b/examples/cpp/README.md
@@ -14,7 +14,7 @@ following command:
```sh
-$ git clone https://github.com/grpc/grpc.git
+$ git clone -b $(curl -L http://grpc.io/release) https://github.com/grpc/grpc
```
Change your current directory to examples/cpp/helloworld
diff --git a/examples/cpp/cpptutorial.md b/examples/cpp/cpptutorial.md
index ef9ca99c0f..80fef07192 100644
--- a/examples/cpp/cpptutorial.md
+++ b/examples/cpp/cpptutorial.md
@@ -20,7 +20,7 @@ With gRPC we can define our service once in a .proto file and implement clients
The example code for our tutorial is in [examples/cpp/route_guide](route_guide). To download the example, clone this repository by running the following command:
```shell
-$ git clone https://github.com/grpc/grpc.git
+$ git clone -b $(curl -L http://grpc.io/release) https://github.com/grpc/grpc
```
Then change your current directory to `examples/cpp/route_guide`:
diff --git a/examples/cpp/helloworld/Makefile b/examples/cpp/helloworld/Makefile
index 58a82dbb83..780e5e427a 100644
--- a/examples/cpp/helloworld/Makefile
+++ b/examples/cpp/helloworld/Makefile
@@ -32,7 +32,7 @@
CXX = g++
CPPFLAGS += -I/usr/local/include -pthread
CXXFLAGS += -std=c++11
-LDFLAGS += -L/usr/local/lib `pkg-config --libs grpc++` -lprotobuf -lpthread -ldl
+LDFLAGS += -L/usr/local/lib `pkg-config --libs grpc++ grpc` -lprotobuf -lpthread -ldl
PROTOC = protoc
GRPC_CPP_PLUGIN = grpc_cpp_plugin
GRPC_CPP_PLUGIN_PATH ?= `which $(GRPC_CPP_PLUGIN)`
diff --git a/examples/cpp/helloworld/README.md b/examples/cpp/helloworld/README.md
index 04283eabc3..db953f5362 100644
--- a/examples/cpp/helloworld/README.md
+++ b/examples/cpp/helloworld/README.md
@@ -12,7 +12,7 @@ following command:
```sh
-$ git clone https://github.com/grpc/grpc.git
+$ git clone -b $(curl -L http://grpc.io/release) https://github.com/grpc/grpc
```
Change your current directory to examples/cpp/helloworld
diff --git a/examples/cpp/helloworld/greeter_async_client.cc b/examples/cpp/helloworld/greeter_async_client.cc
index c1f5eb55f0..33de59fb95 100644
--- a/examples/cpp/helloworld/greeter_async_client.cc
+++ b/examples/cpp/helloworld/greeter_async_client.cc
@@ -87,7 +87,9 @@ class GreeterClient {
void* got_tag;
bool ok = false;
// Block until the next result is available in the completion queue "cq".
- cq.Next(&got_tag, &ok);
+ // The return value of Next should always be checked. This return value
+ // tells us whether there is any kind of event or the cq_ is shutting down.
+ GPR_ASSERT(cq.Next(&got_tag, &ok));
// Verify that the result from "cq" corresponds, by its tag, our previous
// request.
diff --git a/examples/cpp/helloworld/greeter_async_server.cc b/examples/cpp/helloworld/greeter_async_server.cc
index 64e065b1e4..ead44182e5 100644
--- a/examples/cpp/helloworld/greeter_async_server.cc
+++ b/examples/cpp/helloworld/greeter_async_server.cc
@@ -160,7 +160,9 @@ class ServerImpl final {
// Block waiting to read the next event from the completion queue. The
// event is uniquely identified by its tag, which in this case is the
// memory address of a CallData instance.
- cq_->Next(&tag, &ok);
+ // The return value of Next should always be checked. This return value
+ // tells us whether there is any kind of event or cq_ is shutting down.
+ GPR_ASSERT(cq_->Next(&tag, &ok));
GPR_ASSERT(ok);
static_cast<CallData*>(tag)->Proceed();
}