diff options
author | yang-g <yangg@google.com> | 2015-08-20 10:59:29 -0700 |
---|---|---|
committer | yang-g <yangg@google.com> | 2015-08-20 10:59:29 -0700 |
commit | 431f8c2b5feecf202c484f6d0d1d7a0cf6f4be73 (patch) | |
tree | 440c1c9b18b776d79739e8c3620df6be6e3d42ad /include | |
parent | 8c2be9f22807870585111d88f5168dd11da99ce1 (diff) |
make registermethod private
Diffstat (limited to 'include')
-rw-r--r-- | include/grpc++/channel.h | 5 | ||||
-rw-r--r-- | include/grpc++/impl/rpc_method.h | 11 |
2 files changed, 11 insertions, 5 deletions
diff --git a/include/grpc++/channel.h b/include/grpc++/channel.h index a4cef1b4d9..ceb921eff8 100644 --- a/include/grpc++/channel.h +++ b/include/grpc++/channel.h @@ -94,9 +94,6 @@ class Channel GRPC_FINAL : public GrpcLibrary, return WaitForStateChangeImpl(last_observed, deadline_tp.raw_time()); } - // Used by Stub only in generated code. - void* RegisterMethod(const char* method); - private: template <class R> friend class ::grpc::ClientReader; @@ -117,10 +114,12 @@ class Channel GRPC_FINAL : public GrpcLibrary, ClientContext* context, const InputMessage& request, OutputMessage* result); + friend class ::grpc::RpcMethod; Call CreateCall(const RpcMethod& method, ClientContext* context, CompletionQueue* cq); void PerformOpsOnCall(CallOpSetInterface* ops, Call* call); + void* RegisterMethod(const char* method); void NotifyOnStateChangeImpl(grpc_connectivity_state last_observed, gpr_timespec deadline, CompletionQueue* cq, diff --git a/include/grpc++/impl/rpc_method.h b/include/grpc++/impl/rpc_method.h index 50a160b08c..912ffab21f 100644 --- a/include/grpc++/impl/rpc_method.h +++ b/include/grpc++/impl/rpc_method.h @@ -34,6 +34,10 @@ #ifndef GRPCXX_IMPL_RPC_METHOD_H #define GRPCXX_IMPL_RPC_METHOD_H +#include <memory> + +#include <grpc++/channel.h> + namespace grpc { class RpcMethod { @@ -45,8 +49,11 @@ class RpcMethod { BIDI_STREAMING }; - RpcMethod(const char* name, RpcType type, void* channel_tag) - : name_(name), method_type_(type), channel_tag_(channel_tag) {} + RpcMethod(const char* name, RpcType type, + const std::shared_ptr<Channel>& channel) + : name_(name), + method_type_(type), + channel_tag_(channel->RegisterMethod(name)) {} const char* name() const { return name_; } RpcType method_type() const { return method_type_; } |