diff options
Diffstat (limited to 'include/grpc++/client_context.h')
-rw-r--r-- | include/grpc++/client_context.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h index a58e9872e6..6d9015f278 100644 --- a/include/grpc++/client_context.h +++ b/include/grpc++/client_context.h @@ -51,6 +51,7 @@ namespace grpc { class CallOpBuffer; class ChannelInterface; class CompletionQueue; +class Credentials; class RpcMethod; class Status; template <class R> @@ -102,6 +103,11 @@ class ClientContext { void set_authority(const grpc::string& authority) { authority_ = authority; } + // Set credentials for the rpc. + void set_credentials(const std::shared_ptr<Credentials>& creds) { + creds_ = creds; + } + void TryCancel(); private: @@ -127,11 +133,8 @@ class ClientContext { friend class ::grpc::ClientAsyncResponseReader; grpc_call* call() { return call_; } - void set_call(grpc_call* call, const std::shared_ptr<ChannelInterface>& channel) { - GPR_ASSERT(call_ == nullptr); - call_ = call; - channel_ = channel; - } + void set_call(grpc_call* call, + const std::shared_ptr<ChannelInterface>& channel); grpc_completion_queue* cq() { return cq_; } void set_cq(grpc_completion_queue* cq) { cq_ = cq; } @@ -144,6 +147,7 @@ class ClientContext { grpc_completion_queue* cq_; gpr_timespec deadline_; grpc::string authority_; + std::shared_ptr<Credentials> creds_; std::multimap<grpc::string, grpc::string> send_initial_metadata_; std::multimap<grpc::string, grpc::string> recv_initial_metadata_; std::multimap<grpc::string, grpc::string> trailing_metadata_; |