aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Sree Kuchibhotla <sreecha@users.noreply.github.com>2016-03-04 14:32:50 -0500
committerGravatar Sree Kuchibhotla <sreecha@users.noreply.github.com>2016-03-04 14:32:50 -0500
commitedd96e4926373644bac1c169431c213d361bed21 (patch)
treef471b62ef9ad25f06cb83b8f49b522c96a30ec27 /src
parent22e53cbac6e9c153b935a681811593b8e8e65857 (diff)
Revert "Properly integrate async API with server-side cancellations."
Diffstat (limited to 'src')
-rw-r--r--src/cpp/server/server_context.cc26
1 files changed, 8 insertions, 18 deletions
diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc
index eb49b21037..e205a1969b 100644
--- a/src/cpp/server/server_context.cc
+++ b/src/cpp/server/server_context.cc
@@ -62,11 +62,7 @@ class ServerContext::CompletionOp GRPC_FINAL : public CallOpSetInterface {
void FillOps(grpc_op* ops, size_t* nops) GRPC_OVERRIDE;
bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE;
- bool CheckCancelled(CompletionQueue* cq) {
- cq->TryPluck(this);
- return CheckCancelledNoPluck();
- }
- bool CheckCancelledAsync() { return CheckCancelledNoPluck(); }
+ bool CheckCancelled(CompletionQueue* cq);
void set_tag(void* tag) {
has_tag_ = true;
@@ -76,11 +72,6 @@ class ServerContext::CompletionOp GRPC_FINAL : public CallOpSetInterface {
void Unref();
private:
- bool CheckCancelledNoPluck() {
- grpc::lock_guard<grpc::mutex> g(mu_);
- return finalized_ ? (cancelled_ != 0) : false;
- }
-
bool has_tag_;
void* tag_;
grpc::mutex mu_;
@@ -97,6 +88,12 @@ void ServerContext::CompletionOp::Unref() {
}
}
+bool ServerContext::CompletionOp::CheckCancelled(CompletionQueue* cq) {
+ cq->TryPluck(this);
+ grpc::lock_guard<grpc::mutex> g(mu_);
+ return finalized_ ? cancelled_ != 0 : false;
+}
+
void ServerContext::CompletionOp::FillOps(grpc_op* ops, size_t* nops) {
ops->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
ops->data.recv_close_on_server.cancelled = &cancelled_;
@@ -185,14 +182,7 @@ void ServerContext::TryCancel() const {
}
bool ServerContext::IsCancelled() const {
- if (has_notify_when_done_tag_) {
- // when using async API, but the result is only valid
- // if the tag has already been delivered at the completion queue
- return completion_op_ && completion_op_->CheckCancelledAsync();
- } else {
- // when using sync API
- return completion_op_ && completion_op_->CheckCancelled(cq_);
- }
+ return completion_op_ && completion_op_->CheckCancelled(cq_);
}
void ServerContext::set_compression_level(grpc_compression_level level) {