Merge branch 'master' of github.com:vjpai/grpc

pull/1127/head
vjpai 10 years ago
commit 1856db41af
  1. 3
      include/grpc++/server_context.h
  2. 6
      src/cpp/server/server_context.cc

@ -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_;

@ -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

Loading…
Cancel
Save