aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpc++/impl
diff options
context:
space:
mode:
authorGravatar vjpai <vpai@google.com>2016-06-23 10:16:00 -0700
committerGravatar vjpai <vpai@google.com>2016-06-23 10:16:00 -0700
commit7142a91fc961fa6be7093134b13d7b00896e40f0 (patch)
tree13494fbc9fa5f0c6184d5ae3613d8929013ba083 /include/grpc++/impl
parentba6597f297b1cc1a8d91ca9154fee81c1639acdd (diff)
Fix up service types and method handlers so that FC unary can work properly.
Diffstat (limited to 'include/grpc++/impl')
-rw-r--r--include/grpc++/impl/codegen/rpc_method.h3
-rw-r--r--include/grpc++/impl/codegen/rpc_service_method.h1
-rw-r--r--include/grpc++/impl/codegen/service_type.h7
3 files changed, 10 insertions, 1 deletions
diff --git a/include/grpc++/impl/codegen/rpc_method.h b/include/grpc++/impl/codegen/rpc_method.h
index 53bee3727e..728ba3e334 100644
--- a/include/grpc++/impl/codegen/rpc_method.h
+++ b/include/grpc++/impl/codegen/rpc_method.h
@@ -61,11 +61,12 @@ class RpcMethod {
const char* name() const { return name_; }
RpcType method_type() const { return method_type_; }
+ void SetMethodType(RpcType type) { method_type_ = type; }
void* channel_tag() const { return channel_tag_; }
private:
const char* const name_;
- const RpcType method_type_;
+ RpcType method_type_;
void* const channel_tag_;
};
diff --git a/include/grpc++/impl/codegen/rpc_service_method.h b/include/grpc++/impl/codegen/rpc_service_method.h
index 8b1f026c91..02da2a2617 100644
--- a/include/grpc++/impl/codegen/rpc_service_method.h
+++ b/include/grpc++/impl/codegen/rpc_service_method.h
@@ -82,6 +82,7 @@ class RpcServiceMethod : public RpcMethod {
// if MethodHandler is nullptr, then this is an async method
MethodHandler* handler() const { return handler_.get(); }
void ResetHandler() { handler_.reset(); }
+ void SetHandler(MethodHandler *handler) { handler_.reset(handler); }
private:
void* server_tag_;
diff --git a/include/grpc++/impl/codegen/service_type.h b/include/grpc++/impl/codegen/service_type.h
index c19dfc7d45..c0eeace8a4 100644
--- a/include/grpc++/impl/codegen/service_type.h
+++ b/include/grpc++/impl/codegen/service_type.h
@@ -147,6 +147,13 @@ class Service {
methods_[index].reset();
}
+ void MarkMethodFCUnary(int index, MethodHandler* fc_unary_method) {
+ GPR_CODEGEN_ASSERT(methods_[index] && methods_[index]->handler() &&
+ "Cannot mark an async or generic method as FCUnary");
+ methods_[index]->SetMethodType(::grpc::RpcMethod::FC_UNARY);
+ methods_[index]->SetHandler(fc_unary_method);
+ }
+
private:
friend class Server;
friend class ServerInterface;