Skip to content
Snippets Groups Projects
Commit c07d9bf6 authored by yang-g's avatar yang-g
Browse files

client api

parent 26d533eb
No related branches found
No related tags found
No related merge requests found
......@@ -118,6 +118,8 @@ class ClientContext {
std::shared_ptr<const AuthContext> auth_context() const;
grpc::string peer() const;
// Get and set census context
void set_census_context(census_context* ccp) { census_context_ = ccp; }
census_context* get_census_context() const { return census_context_; }
......
......@@ -34,6 +34,7 @@
#include <grpc++/client_context.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
#include <grpc++/credentials.h>
#include <grpc++/time.h>
......@@ -104,4 +105,14 @@ void ClientContext::TryCancel() {
}
}
grpc::string ClientContext::peer() const {
grpc::string peer;
if (call_) {
char* c_peer = grpc_call_get_peer(call_);
peer = c_peer;
gpr_free(c_peer);
}
return peer;
}
} // namespace grpc
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment