diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h index 24e67c9ee1fb5740b90a3bb3e118fa3afae008c0..52bedd4d38ea499631dea956c9965a7c4be7161a 100644 --- a/include/grpc++/client_context.h +++ b/include/grpc++/client_context.h @@ -81,12 +81,12 @@ class ClientContext { void AddMetadata(const grpc::string &meta_key, 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_); return recv_initial_metadata_; } - std::multimap<grpc::string, grpc::string> GetServerTrailingMetadata() { + const std::multimap<grpc::string, grpc::string>& GetServerTrailingMetadata() { // TODO(yangg) check finished return trailing_metadata_; } diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index 06744f8f4fd7ba06d8c94e06d34f52cd7e969252..520278f9492a50fee7a97fbba97216565e5153be 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -76,7 +76,7 @@ class ServerContext final { void AddInitialMetadata(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_; }