diff options
author | 2014-12-11 15:57:37 -0800 | |
---|---|---|
committer | 2014-12-12 16:08:10 -0800 | |
commit | 87da1b937dc478a1562c1e0ed6c80256e7ee2c53 (patch) | |
tree | 5d76f8841133d4ae5c9a10e95b9bcd6569ed443e /src/cpp/client/client_context.cc | |
parent | 33a2168453a65e032f9582b3166e369d3f826c67 (diff) |
Make the default deadline gpr_inf_future to avoid mismatch between
gpr_inf_future and time_point::max(). The redundant AbsoluteDeadline prefix is removed from the utility function names.
Now the ClientContext holds a gpr_timespec instead of a time_point.
A test will be added in the server side deadline support cl.
Change on 2014/12/11 by yangg <yangg@google.com>
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=81920769
Diffstat (limited to 'src/cpp/client/client_context.cc')
-rw-r--r-- | src/cpp/client/client_context.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/cpp/client/client_context.cc b/src/cpp/client/client_context.cc index 58a8ad252b..505b7d89b4 100644 --- a/src/cpp/client/client_context.cc +++ b/src/cpp/client/client_context.cc @@ -34,15 +34,14 @@ #include <grpc++/client_context.h> #include <grpc/grpc.h> +#include "src/cpp/util/time.h" using std::chrono::system_clock; namespace grpc { ClientContext::ClientContext() - : call_(nullptr), - cq_(nullptr), - absolute_deadline_(system_clock::time_point::max()) {} + : call_(nullptr), cq_(nullptr), absolute_deadline_(gpr_inf_future) {} ClientContext::~ClientContext() { if (call_) { @@ -64,11 +63,11 @@ ClientContext::~ClientContext() { void ClientContext::set_absolute_deadline( const system_clock::time_point& deadline) { - absolute_deadline_ = deadline; + Timepoint2Timespec(deadline, &absolute_deadline_); } system_clock::time_point ClientContext::absolute_deadline() { - return absolute_deadline_; + return Timespec2Timepoint(absolute_deadline_); } void ClientContext::AddMetadata(const grpc::string& meta_key, |