|
|
@ -1083,16 +1083,14 @@ bool Server::RegisterService(const grpc::string* host, grpc::Service* service) { |
|
|
|
|
|
|
|
|
|
|
|
const char* method_name = nullptr; |
|
|
|
const char* method_name = nullptr; |
|
|
|
|
|
|
|
|
|
|
|
for (auto it = service->methods_.begin(); it != service->methods_.end(); |
|
|
|
for (const auto& method : service->methods_) { |
|
|
|
++it) { |
|
|
|
if (method.get() == nullptr) { // Handled by generic service if any.
|
|
|
|
if (it->get() == nullptr) { // Handled by generic service if any.
|
|
|
|
|
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
grpc::internal::RpcServiceMethod* method = it->get(); |
|
|
|
|
|
|
|
void* method_registration_tag = grpc_server_register_method( |
|
|
|
void* method_registration_tag = grpc_server_register_method( |
|
|
|
server_, method->name(), host ? host->c_str() : nullptr, |
|
|
|
server_, method->name(), host ? host->c_str() : nullptr, |
|
|
|
PayloadHandlingForMethod(method), 0); |
|
|
|
PayloadHandlingForMethod(method.get()), 0); |
|
|
|
if (method_registration_tag == nullptr) { |
|
|
|
if (method_registration_tag == nullptr) { |
|
|
|
gpr_log(GPR_DEBUG, "Attempt to register %s multiple times", |
|
|
|
gpr_log(GPR_DEBUG, "Attempt to register %s multiple times", |
|
|
|
method->name()); |
|
|
|
method->name()); |
|
|
@ -1104,7 +1102,7 @@ bool Server::RegisterService(const grpc::string* host, grpc::Service* service) { |
|
|
|
} else if (method->api_type() == |
|
|
|
} else if (method->api_type() == |
|
|
|
grpc::internal::RpcServiceMethod::ApiType::SYNC) { |
|
|
|
grpc::internal::RpcServiceMethod::ApiType::SYNC) { |
|
|
|
for (const auto& value : sync_req_mgrs_) { |
|
|
|
for (const auto& value : sync_req_mgrs_) { |
|
|
|
value->AddSyncMethod(method, method_registration_tag); |
|
|
|
value->AddSyncMethod(method.get(), method_registration_tag); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// a callback method. Register at least some callback requests
|
|
|
|
// a callback method. Register at least some callback requests
|
|
|
@ -1113,8 +1111,8 @@ bool Server::RegisterService(const grpc::string* host, grpc::Service* service) { |
|
|
|
// TODO(vjpai): Register these dynamically based on need
|
|
|
|
// TODO(vjpai): Register these dynamically based on need
|
|
|
|
for (int i = 0; i < DEFAULT_CALLBACK_REQS_PER_METHOD; i++) { |
|
|
|
for (int i = 0; i < DEFAULT_CALLBACK_REQS_PER_METHOD; i++) { |
|
|
|
callback_reqs_to_start_.push_back( |
|
|
|
callback_reqs_to_start_.push_back( |
|
|
|
new CallbackRequest<grpc::ServerContext>(this, method_index, method, |
|
|
|
new CallbackRequest<grpc::ServerContext>( |
|
|
|
method_registration_tag)); |
|
|
|
this, method_index, method.get(), method_registration_tag)); |
|
|
|
} |
|
|
|
} |
|
|
|
// Enqueue it so that it will be Request'ed later after all request
|
|
|
|
// Enqueue it so that it will be Request'ed later after all request
|
|
|
|
// matchers are created at core server startup
|
|
|
|
// matchers are created at core server startup
|
|
|
|