diff options
author | Craig Tiller <ctiller@google.com> | 2016-04-05 16:07:25 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2016-04-05 16:07:25 -0700 |
commit | 859fb06e80d63255ba614ad8c7fc91df50bd101b (patch) | |
tree | 4bad8e4f0638972cea827a007cdc13c3f6072447 /src/cpp/server/server.cc | |
parent | d1697d99d775bddd4f81fb1239eb415eeccc317f (diff) | |
parent | d08c6ae5aa1b74adde7f819e566ab0097b649987 (diff) |
Merge branch 'optionalize_client_config' into strong-includes
Diffstat (limited to 'src/cpp/server/server.cc')
-rw-r--r-- | src/cpp/server/server.cc | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 3e44c502fc..fafe31e84c 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -321,6 +321,19 @@ void Server::SetGlobalCallbacks(GlobalCallbacks* callbacks) { g_callbacks.reset(callbacks); } +static grpc_server_register_method_payload_handling PayloadHandlingForMethod( + RpcServiceMethod* method) { + switch (method->method_type()) { + case RpcMethod::NORMAL_RPC: + case RpcMethod::SERVER_STREAMING: + return GRPC_SRM_PAYLOAD_READ_INITIAL_BYTE_BUFFER; + case RpcMethod::CLIENT_STREAMING: + case RpcMethod::BIDI_STREAMING: + return GRPC_SRM_PAYLOAD_NONE; + } + GPR_UNREACHABLE_CODE(return GRPC_SRM_PAYLOAD_NONE;); +} + bool Server::RegisterService(const grpc::string* host, Service* service) { bool has_async_methods = service->has_async_methods(); if (has_async_methods) { @@ -334,8 +347,9 @@ bool Server::RegisterService(const grpc::string* host, Service* service) { continue; } RpcServiceMethod* method = it->get(); - void* tag = grpc_server_register_method(server_, method->name(), - host ? host->c_str() : nullptr, 0); + void* tag = grpc_server_register_method( + server_, method->name(), host ? host->c_str() : nullptr, + PayloadHandlingForMethod(method), 0); if (tag == nullptr) { gpr_log(GPR_DEBUG, "Attempt to register %s multiple times", method->name()); |