From bb5227fc39fb44ae27d33d934470acd81f2ae57f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 11 Feb 2015 13:34:48 -0800 Subject: Allow server to hook calls also, fix crash --- include/grpc++/impl/call.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'include/grpc++/impl') diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index d0cb9024ba..bc1a3d847d 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -52,7 +52,7 @@ struct grpc_op; namespace grpc { -class ChannelInterface; +class Call; class CallOpBuffer final : public CompletionQueueTag { public: @@ -103,10 +103,17 @@ class CCallDeleter { void operator()(grpc_call *c); }; +// Channel and Server implement this to allow them to hook performing ops +class CallHook { + public: + virtual ~CallHook() {} + virtual void PerformOpsOnCall(CallOpBuffer *ops, Call *call) = 0; +}; + // Straightforward wrapping of the C call object class Call final { public: - Call(grpc_call *call, ChannelInterface *channel, CompletionQueue *cq); + Call(grpc_call *call, CallHook *call_hook_, CompletionQueue *cq); void PerformOps(CallOpBuffer *buffer); @@ -114,7 +121,7 @@ class Call final { CompletionQueue *cq() { return cq_; } private: - ChannelInterface *channel_; + CallHook *call_hook_; CompletionQueue *cq_; std::unique_ptr call_; }; -- cgit v1.2.3