|
|
@ -51,21 +51,21 @@ std::unique_ptr<ServerCompletionQueue> ServerBuilder::AddCompletionQueue() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void ServerBuilder::RegisterService(SynchronousService* service) { |
|
|
|
void ServerBuilder::RegisterService(SynchronousService* service) { |
|
|
|
services_.emplace_back(service->service()); |
|
|
|
services_.emplace_back(new NamedService<RpcService>(service->service())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void ServerBuilder::RegisterAsyncService(AsynchronousService* service) { |
|
|
|
void ServerBuilder::RegisterAsyncService(AsynchronousService* service) { |
|
|
|
async_services_.emplace_back(service); |
|
|
|
async_services_.emplace_back(new NamedService<AsynchronousService>(service)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void ServerBuilder::RegisterService( |
|
|
|
void ServerBuilder::RegisterService( |
|
|
|
const grpc::string& addr, SynchronousService* service) { |
|
|
|
const grpc::string& addr, SynchronousService* service) { |
|
|
|
services_.emplace_back(addr, service->service()); |
|
|
|
services_.emplace_back(new NamedService<RpcService>(addr, service->service())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void ServerBuilder::RegisterAsyncService( |
|
|
|
void ServerBuilder::RegisterAsyncService( |
|
|
|
const grpc::string& addr, AsynchronousService* service) { |
|
|
|
const grpc::string& addr, AsynchronousService* service) { |
|
|
|
async_services_.emplace_back(addr, service); |
|
|
|
async_services_.emplace_back(new NamedService<AsynchronousService>(addr, service)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void ServerBuilder::RegisterAsyncGenericService(AsyncGenericService* service) { |
|
|
|
void ServerBuilder::RegisterAsyncGenericService(AsyncGenericService* service) { |
|
|
@ -107,13 +107,13 @@ std::unique_ptr<Server> ServerBuilder::BuildAndStart() { |
|
|
|
} |
|
|
|
} |
|
|
|
for (auto service = services_.begin(); service != services_.end(); |
|
|
|
for (auto service = services_.begin(); service != services_.end(); |
|
|
|
service++) { |
|
|
|
service++) { |
|
|
|
if (!server->RegisterService(service->host.get(), service->service)) { |
|
|
|
if (!server->RegisterService((*service)->host.get(), (*service)->service)) { |
|
|
|
return nullptr; |
|
|
|
return nullptr; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
for (auto service = async_services_.begin(); |
|
|
|
for (auto service = async_services_.begin(); |
|
|
|
service != async_services_.end(); service++) { |
|
|
|
service != async_services_.end(); service++) { |
|
|
|
if (!server->RegisterAsyncService(service->host.get(), service->service)) { |
|
|
|
if (!server->RegisterAsyncService((*service)->host.get(), (*service)->service)) { |
|
|
|
return nullptr; |
|
|
|
return nullptr; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|