Added some methods to context inspector. Also minor tweak to server context IsCancelled() method

pull/2413/head
David Garcia Quintas 10 years ago
parent e410986635
commit 6dd49a5c8f
  1. 2
      include/grpc++/server_context.h
  2. 2
      src/cpp/server/server_context.cc
  3. 9
      test/cpp/interop/server_helper.cc
  4. 4
      test/cpp/interop/server_helper.h

@ -97,7 +97,7 @@ class ServerContext {
void AddInitialMetadata(const grpc::string& key, const grpc::string& value);
void AddTrailingMetadata(const grpc::string& key, const grpc::string& value);
bool IsCancelled();
bool IsCancelled() const;
const std::multimap<grpc::string, grpc::string>& client_metadata() {
return client_metadata_;

@ -144,7 +144,7 @@ void ServerContext::AddTrailingMetadata(const grpc::string& key,
trailing_metadata_.insert(std::make_pair(key, value));
}
bool ServerContext::IsCancelled() {
bool ServerContext::IsCancelled() const {
return completion_op_ && completion_op_->CheckCancelled(cq_);
}

@ -62,5 +62,14 @@ InteropContextInspector::InteropContextInspector(
const ::grpc::ServerContext& context)
: context_(context) {}
std::shared_ptr<const AuthContext> InteropContextInspector::GetAuthContext()
const {
return context_.auth_context();
}
bool InteropContextInspector::IsCancelled() const {
return context_.IsCancelled();
}
} // namespace testing
} // namespace grpc

@ -48,7 +48,9 @@ class InteropContextInspector {
public:
InteropContextInspector(const ::grpc::ServerContext& context);
// Inspector methods, able to peek inside ServerContext go here.
// Inspector methods, able to peek inside ServerContext, follow.
std::shared_ptr<const AuthContext> GetAuthContext() const;
bool IsCancelled() const;
private:
const ::grpc::ServerContext& context_;

Loading…
Cancel
Save