Update route_guide

pull/3109/head
Yang Gao 10 years ago
parent d6319001f3
commit 3eab5d2e4a
  1. 2
      cpp/route_guide/Makefile
  2. 4
      cpp/route_guide/route_guide_client.cc
  3. 3
      cpp/route_guide/route_guide_server.cc

@ -32,7 +32,7 @@
CXX = g++
CPPFLAGS = -I/usr/local/include -pthread
CXXFLAGS = -std=c++11
LDFLAGS = -L/usr/local/lib -lgpr -lgrpc -lgrpc++ -lprotobuf -lpthread -ldl
LDFLAGS = -L/usr/local/lib -lgpr -lgrpc -lgrpc++_unsecure -lprotobuf -lpthread -ldl
PROTOC = protoc
GRPC_CPP_PLUGIN = grpc_cpp_plugin
GRPC_CPP_PLUGIN_PATH ?= `which $(GRPC_CPP_PLUGIN)`

@ -43,6 +43,7 @@
#include <grpc++/channel_interface.h>
#include <grpc++/client_context.h>
#include <grpc++/create_channel.h>
#include <grpc++/credentials.h>
#include <grpc++/status.h>
#include <grpc++/stream.h>
#include "helper.h"
@ -242,7 +243,8 @@ int main(int argc, char** argv) {
// Expect only arg: --db_path=path/to/route_guide_db.json.
std::string db = examples::GetDbFileContent(argc, argv);
RouteGuideClient guide(
grpc::CreateChannelDeprecated("localhost:50051", ChannelArguments()),
grpc::CreateChannel("localhost:50051", grpc::InsecureCredentials(),
ChannelArguments()),
db);
std::cout << "-------------- GetFeature --------------" << std::endl;

@ -42,6 +42,7 @@
#include <grpc++/server.h>
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
#include <grpc++/server_credentials.h>
#include <grpc++/status.h>
#include <grpc++/stream.h>
#include "helper.h"
@ -186,7 +187,7 @@ void RunServer(const std::string& db_path) {
RouteGuideImpl service(db_path);
ServerBuilder builder;
builder.AddPort(server_address);
builder.AddPort(server_address, grpc::InsecureServerCredentials());
builder.RegisterService(&service);
std::unique_ptr<Server> server(builder.BuildAndStart());
std::cout << "Server listening on " << server_address << std::endl;

Loading…
Cancel
Save