diff options
author | Yash Tibrewal <yashkt@google.com> | 2018-10-22 10:39:27 -0700 |
---|---|---|
committer | Yash Tibrewal <yashkt@google.com> | 2018-10-22 10:39:27 -0700 |
commit | b358ef85dc5a19c43929002b96cabc281b04d8bd (patch) | |
tree | 15fb1939d6b3580d33b53db8713c6bddbb52340f /include | |
parent | 9b83b7d19e0a3e14dbfca2f40fa8157547c190f4 (diff) | |
parent | 340bffa55560f02944dd81413aa764081a60f329 (diff) |
Merge branch 'master' into interceptors
Diffstat (limited to 'include')
-rw-r--r-- | include/grpc/grpc.h | 5 | ||||
-rw-r--r-- | include/grpcpp/channel.h | 2 | ||||
-rw-r--r-- | include/grpcpp/impl/codegen/call.h | 19 | ||||
-rw-r--r-- | include/grpcpp/impl/codegen/call_wrapper.h | 5 | ||||
-rw-r--r-- | include/grpcpp/impl/codegen/channel_interface.h | 10 | ||||
-rw-r--r-- | include/grpcpp/impl/codegen/completion_queue.h | 1 | ||||
-rw-r--r-- | include/grpcpp/impl/codegen/intercepted_channel.h | 4 |
7 files changed, 40 insertions, 6 deletions
diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 02ab6e8ba4..514d9ddc4b 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -248,10 +248,13 @@ GRPCAPI void* grpc_call_arena_alloc(grpc_call* call, size_t size); appropriate to call grpc_completion_queue_next or grpc_completion_queue_pluck consequent to the failed grpc_call_start_batch call. + If a call to grpc_call_start_batch with an empty batch returns + GRPC_CALL_OK, the tag is put in the completion queue immediately. THREAD SAFETY: access to grpc_call_start_batch in multi-threaded environment needs to be synchronized. As an optimization, you may synchronize batches containing just send operations independently from batches containing just - receive operations. */ + receive operations. Access to grpc_call_start_batch with an empty batch is + thread-compatible. */ GRPCAPI grpc_call_error grpc_call_start_batch(grpc_call* call, const grpc_op* ops, size_t nops, void* tag, void* reserved); diff --git a/include/grpcpp/channel.h b/include/grpcpp/channel.h index 6f89e36fca..624000b75f 100644 --- a/include/grpcpp/channel.h +++ b/include/grpcpp/channel.h @@ -90,7 +90,7 @@ class Channel final : public ChannelInterface, internal::Call CreateCallInternal(const internal::RpcMethod& method, ClientContext* context, CompletionQueue* cq, - int interceptor_pos); + int interceptor_pos) override; const grpc::string host_; grpc_channel* const c_channel_; // owned diff --git a/include/grpcpp/impl/codegen/call.h b/include/grpcpp/impl/codegen/call.h index f4aae6fdc8..51cc18e2b1 100644 --- a/include/grpcpp/impl/codegen/call.h +++ b/include/grpcpp/impl/codegen/call.h @@ -1145,6 +1145,25 @@ class CallOpSet : public CallOpSetInterface, public Op6 { public: CallOpSet() : cq_tag_(this), return_tag_(this) {} + // The copy constructor and assignment operator reset the value of + // cq_tag_ and return_tag_ since those are only meaningful on a specific + // object, not across objects. + CallOpSet(const CallOpSet& other) + : cq_tag_(this), + return_tag_(this), + call_(other.call_), + done_intercepting_(false), + interceptor_methods_(InterceptorBatchMethodsImpl()) {} + + CallOpSet& operator=(const CallOpSet& other) { + cq_tag_ = this; + return_tag_ = this; + call_ = other.call_; + done_intercepting_ = false; + interceptor_methods_ = InterceptorBatchMethodsImpl(); + return *this; + } + void FillOps(Call* call) override { done_intercepting_ = false; g_core_codegen_interface->grpc_call_ref(call->call()); diff --git a/include/grpcpp/impl/codegen/call_wrapper.h b/include/grpcpp/impl/codegen/call_wrapper.h index 42216f9b6e..675e36feb9 100644 --- a/include/grpcpp/impl/codegen/call_wrapper.h +++ b/include/grpcpp/impl/codegen/call_wrapper.h @@ -29,6 +29,7 @@ class ServerRpcInfo; } // namespace experimental namespace internal { class CallHook; +class CallOpSetInterface; /// Straightforward wrapping of the C call object class Call final { @@ -61,9 +62,7 @@ class Call final { max_receive_message_size_(max_receive_message_size), server_rpc_info_(rpc_info) {} - void PerformOps(CallOpSetInterface* ops) { - call_hook_->PerformOpsOnCall(ops, this); - } + void PerformOps(CallOpSetInterface* ops); grpc_call* call() const { return call_; } CompletionQueue* cq() const { return cq_; } diff --git a/include/grpcpp/impl/codegen/channel_interface.h b/include/grpcpp/impl/codegen/channel_interface.h index 4427f55f35..03fa502df6 100644 --- a/include/grpcpp/impl/codegen/channel_interface.h +++ b/include/grpcpp/impl/codegen/channel_interface.h @@ -20,6 +20,7 @@ #define GRPCPP_IMPL_CODEGEN_CHANNEL_INTERFACE_H #include <grpc/impl/codegen/connectivity_state.h> +#include <grpcpp/impl/codegen/call_wrapper.h> #include <grpcpp/impl/codegen/status.h> #include <grpcpp/impl/codegen/time.h> @@ -121,6 +122,15 @@ class ChannelInterface { CompletionQueue* cq, void* tag) = 0; virtual bool WaitForStateChangeImpl(grpc_connectivity_state last_observed, gpr_timespec deadline) = 0; + // This is needed to keep codegen_test_minimal happy. InterceptedChannel needs + // to make use of this but can't directly call Channel's implementation + // because of the test. + virtual internal::Call CreateCallInternal(const internal::RpcMethod& method, + ClientContext* context, + CompletionQueue* cq, + int interceptor_pos) { + return internal::Call(); + } // EXPERIMENTAL // A method to get the callbackable completion queue associated with this diff --git a/include/grpcpp/impl/codegen/completion_queue.h b/include/grpcpp/impl/codegen/completion_queue.h index 34c2a477ae..fc1ed3278a 100644 --- a/include/grpcpp/impl/codegen/completion_queue.h +++ b/include/grpcpp/impl/codegen/completion_queue.h @@ -390,6 +390,7 @@ class ServerCompletionQueue : public CompletionQueue { grpc_cq_polling_type polling_type_; friend class ServerBuilder; + friend class Server; }; } // namespace grpc diff --git a/include/grpcpp/impl/codegen/intercepted_channel.h b/include/grpcpp/impl/codegen/intercepted_channel.h index 545ad1d965..91d9cd84e3 100644 --- a/include/grpcpp/impl/codegen/intercepted_channel.h +++ b/include/grpcpp/impl/codegen/intercepted_channel.h @@ -43,7 +43,9 @@ class InterceptedChannel : public ChannelInterface { internal::Call CreateCall(const internal::RpcMethod& method, ClientContext* context, - CompletionQueue* cq) override; + CompletionQueue* cq) override { + return channel_->CreateCallInternal(method, context, cq, interceptor_pos_); + } void PerformOpsOnCall(internal::CallOpSetInterface* ops, internal::Call* call) override { |