Merge pull request #579 from yang-g/c++api

change metadata getters to return const&
pull/582/head
Craig Tiller 10 years ago
commit 7326901767
  1. 4
      include/grpc++/client_context.h
  2. 2
      include/grpc++/server_context.h

@ -81,12 +81,12 @@ class ClientContext {
void AddMetadata(const grpc::string &meta_key, void AddMetadata(const grpc::string &meta_key,
const grpc::string &meta_value); const grpc::string &meta_value);
std::multimap<grpc::string, grpc::string> GetServerInitialMetadata() { const std::multimap<grpc::string, grpc::string>& GetServerInitialMetadata() {
GPR_ASSERT(initial_metadata_received_); GPR_ASSERT(initial_metadata_received_);
return recv_initial_metadata_; return recv_initial_metadata_;
} }
std::multimap<grpc::string, grpc::string> GetServerTrailingMetadata() { const std::multimap<grpc::string, grpc::string>& GetServerTrailingMetadata() {
// TODO(yangg) check finished // TODO(yangg) check finished
return trailing_metadata_; return trailing_metadata_;
} }

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

Loading…
Cancel
Save