aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp/server
diff options
context:
space:
mode:
authorGravatar Nicolas Noble <nnoble@google.com>2015-04-24 18:17:45 -0700
committerGravatar Nicolas "Pixel" Noble <pixel@nobis-crew.org>2015-04-28 00:27:30 +0200
commit30862038340711e36a741ba166b7d198c3ad6b0a (patch)
tree63607334c42f9e5428b2ece037aa54b44a917584 /src/cpp/server
parent7305dc69e69fbd808f932a8b11c433bdcbe8a79d (diff)
Few VS2010 fixes.
-) = delete isn't supported. Moving destructor out of scope. -) variadic templates aren't supported. Replacing emplace_back's construction. -) C++11's {} inline construction isn't supported. Adding temporary variables. -) std::list<> can't work on a non-declared class. Changing to a raw pointer.
Diffstat (limited to 'src/cpp/server')
-rw-r--r--src/cpp/server/server.cc9
-rw-r--r--src/cpp/server/server_builder.cc3
2 files changed, 8 insertions, 4 deletions
diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc
index 1d39378595..4694a3a7ff 100644
--- a/src/cpp/server/server.cc
+++ b/src/cpp/server/server.cc
@@ -180,6 +180,7 @@ Server::Server(ThreadPoolInterface* thread_pool, bool thread_pool_owned)
: started_(false),
shutdown_(false),
num_running_cb_(0),
+ sync_methods_(new std::list<SyncRequest>),
server_(grpc_server_create(cq_.cq(), nullptr)),
thread_pool_(thread_pool),
thread_pool_owned_(thread_pool_owned) {}
@@ -196,6 +197,7 @@ Server::~Server() {
if (thread_pool_owned_) {
delete thread_pool_;
}
+ delete sync_methods_;
}
bool Server::RegisterService(RpcService* service) {
@@ -208,7 +210,8 @@ bool Server::RegisterService(RpcService* service) {
method->name());
return false;
}
- sync_methods_.emplace_back(method, tag);
+ SyncRequest request(method, tag);
+ sync_methods_->emplace_back(request);
}
return true;
}
@@ -250,8 +253,8 @@ bool Server::Start() {
grpc_server_start(server_);
// Start processing rpcs.
- if (!sync_methods_.empty()) {
- for (auto m = sync_methods_.begin(); m != sync_methods_.end(); m++) {
+ if (!sync_methods_->empty()) {
+ for (auto m = sync_methods_->begin(); m != sync_methods_->end(); m++) {
m->Request(server_);
}
diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc
index c5e115f396..81cb0e6724 100644
--- a/src/cpp/server/server_builder.cc
+++ b/src/cpp/server/server_builder.cc
@@ -66,7 +66,8 @@ void ServerBuilder::RegisterAsyncGenericService(AsyncGenericService* service) {
void ServerBuilder::AddListeningPort(const grpc::string& addr,
std::shared_ptr<ServerCredentials> creds,
int* selected_port) {
- ports_.push_back(Port{addr, creds, selected_port});
+ Port port = {addr, creds, selected_port};
+ ports_.push_back(port);
}
void ServerBuilder::SetThreadPool(ThreadPoolInterface* thread_pool) {