aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Vijay Pai <vpai@google.com>2015-03-24 10:38:18 -0700
committerGravatar Vijay Pai <vpai@google.com>2015-03-24 10:38:18 -0700
commit652b7e983b45be22ec7f887e7f90d536cec994c2 (patch)
treeb8e0ebda7d4cc50732b1e1b37f7bf9d2f67651c7
parent82dd80abc6fffab0f0bcff406dbd0750a6a45b37 (diff)
Revert "Remove dead members of server context"
-rw-r--r--include/grpc++/server_context.h3
-rw-r--r--src/cpp/server/server_context.cc6
2 files changed, 9 insertions, 0 deletions
diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h
index 36cbae87a0..9e3b80c641 100644
--- a/include/grpc++/server_context.h
+++ b/include/grpc++/server_context.h
@@ -78,6 +78,8 @@ class ServerContext {
void AddInitialMetadata(const grpc::string& key, const grpc::string& value);
void AddTrailingMetadata(const grpc::string& key, const grpc::string& value);
+ bool IsCancelled();
+
const std::multimap<grpc::string, grpc::string>& client_metadata() {
return client_metadata_;
}
@@ -110,6 +112,7 @@ class ServerContext {
std::chrono::system_clock::time_point deadline_;
grpc_call* call_;
+ CompletionQueue* cq_;
bool sent_initial_metadata_;
std::multimap<grpc::string, grpc::string> client_metadata_;
std::multimap<grpc::string, grpc::string> initial_metadata_;
diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc
index 435a060be5..bb3c2d1405 100644
--- a/src/cpp/server/server_context.cc
+++ b/src/cpp/server/server_context.cc
@@ -94,6 +94,7 @@ bool ServerContext::CompletionOp::FinalizeResult(void** tag, bool* status) {
ServerContext::ServerContext()
: completion_op_(nullptr),
call_(nullptr),
+ cq_(nullptr),
sent_initial_metadata_(false) {}
ServerContext::ServerContext(gpr_timespec deadline, grpc_metadata* metadata,
@@ -101,6 +102,7 @@ ServerContext::ServerContext(gpr_timespec deadline, grpc_metadata* metadata,
: completion_op_(nullptr),
deadline_(Timespec2Timepoint(deadline)),
call_(nullptr),
+ cq_(nullptr),
sent_initial_metadata_(false) {
for (size_t i = 0; i < metadata_count; i++) {
client_metadata_.insert(std::make_pair(
@@ -135,4 +137,8 @@ void ServerContext::AddTrailingMetadata(const grpc::string& key,
trailing_metadata_.insert(std::make_pair(key, value));
}
+bool ServerContext::IsCancelled() {
+ return completion_op_ && completion_op_->CheckCancelled(cq_);
+}
+
} // namespace grpc