aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp/client
diff options
context:
space:
mode:
authorGravatar Nicolas Noble <nnoble@google.com>2015-04-07 18:01:18 -0700
committerGravatar Nicolas "Pixel" Noble <pixel@nobis-crew.org>2015-04-08 05:42:08 +0200
commit89219162dd613b58da8f3cd418f4825a5d566da5 (patch)
tree3c3a4b0a299e7df62caff4562863bde6377d965a /src/cpp/client
parent9973aa3aa6e29e5949f9a330cc3c1eb92c0a5830 (diff)
Refactoring std::chrono out.
Diffstat (limited to 'src/cpp/client')
-rw-r--r--src/cpp/client/channel.cc3
-rw-r--r--src/cpp/client/client_context.cc15
-rw-r--r--src/cpp/client/secure_credentials.cc12
3 files changed, 9 insertions, 21 deletions
diff --git a/src/cpp/client/channel.cc b/src/cpp/client/channel.cc
index 5380d3a232..aaad042026 100644
--- a/src/cpp/client/channel.cc
+++ b/src/cpp/client/channel.cc
@@ -33,7 +33,6 @@
#include "src/cpp/client/channel.h"
-#include <chrono>
#include <memory>
#include <grpc/grpc.h>
@@ -64,7 +63,7 @@ Call Channel::CreateCall(const RpcMethod& method, ClientContext* context,
context->authority().empty()
? target_.c_str()
: context->authority().c_str(),
- context->RawDeadline());
+ context->raw_deadline());
context->set_call(c_call);
return Call(c_call, this, cq);
}
diff --git a/src/cpp/client/client_context.cc b/src/cpp/client/client_context.cc
index de9f8c7201..70c9cb4c3b 100644
--- a/src/cpp/client/client_context.cc
+++ b/src/cpp/client/client_context.cc
@@ -34,9 +34,7 @@
#include <grpc++/client_context.h>
#include <grpc/grpc.h>
-#include "src/cpp/util/time.h"
-
-using std::chrono::system_clock;
+#include <grpc++/time.h>
namespace grpc {
@@ -44,7 +42,7 @@ ClientContext::ClientContext()
: initial_metadata_received_(false),
call_(nullptr),
cq_(nullptr),
- absolute_deadline_(gpr_inf_future) {}
+ deadline_(gpr_inf_future) {}
ClientContext::~ClientContext() {
if (call_) {
@@ -64,15 +62,6 @@ ClientContext::~ClientContext() {
}
}
-void ClientContext::set_absolute_deadline(
- const system_clock::time_point& deadline) {
- Timepoint2Timespec(deadline, &absolute_deadline_);
-}
-
-system_clock::time_point ClientContext::absolute_deadline() {
- return Timespec2Timepoint(absolute_deadline_);
-}
-
void ClientContext::AddMetadata(const grpc::string& meta_key,
const grpc::string& meta_value) {
send_initial_metadata_.insert(std::make_pair(meta_key, meta_value));
diff --git a/src/cpp/client/secure_credentials.cc b/src/cpp/client/secure_credentials.cc
index d6f9acc675..85785ed275 100644
--- a/src/cpp/client/secure_credentials.cc
+++ b/src/cpp/client/secure_credentials.cc
@@ -96,27 +96,27 @@ std::unique_ptr<Credentials> ComputeEngineCredentials() {
// Builds service account credentials.
std::unique_ptr<Credentials> ServiceAccountCredentials(
const grpc::string& json_key, const grpc::string& scope,
- std::chrono::seconds token_lifetime) {
- if (token_lifetime.count() <= 0) {
+ long token_lifetime) {
+ if (token_lifetime <= 0) {
gpr_log(GPR_ERROR,
"Trying to create ServiceAccountCredentials "
"with non-positive lifetime");
return WrapCredentials(nullptr);
}
- gpr_timespec lifetime = gpr_time_from_seconds(token_lifetime.count());
+ gpr_timespec lifetime = gpr_time_from_seconds(token_lifetime);
return WrapCredentials(grpc_service_account_credentials_create(
json_key.c_str(), scope.c_str(), lifetime));
}
// Builds JWT credentials.
std::unique_ptr<Credentials> JWTCredentials(
- const grpc::string& json_key, std::chrono::seconds token_lifetime) {
- if (token_lifetime.count() <= 0) {
+ const grpc::string& json_key, long token_lifetime) {
+ if (token_lifetime <= 0) {
gpr_log(GPR_ERROR,
"Trying to create JWTCredentials with non-positive lifetime");
return WrapCredentials(nullptr);
}
- gpr_timespec lifetime = gpr_time_from_seconds(token_lifetime.count());
+ gpr_timespec lifetime = gpr_time_from_seconds(token_lifetime);
return WrapCredentials(
grpc_jwt_credentials_create(json_key.c_str(), lifetime));
}