diff options
author | Yang Gao <yangg@google.com> | 2015-07-23 16:35:29 -0700 |
---|---|---|
committer | Yang Gao <yangg@google.com> | 2015-07-23 16:35:29 -0700 |
commit | b5bbf667798f28d960edd6f1145d9479a3b39831 (patch) | |
tree | 9774314bc3a0388d6ba769d5da274417a56a717b /src/core | |
parent | 2e7ce156354f77bcbdfe0c096b6fa29ebe320200 (diff) | |
parent | 94329d09656f3eeb8eee40b72b96ec9cd3578559 (diff) |
Merge pull request #2629 from ctiller/always-with-the-mono
Make the server report monotonic times for deadlines
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/surface/call.c | 3 | ||||
-rw-r--r-- | src/core/surface/server.c | 6 | ||||
-rw-r--r-- | src/core/transport/chttp2/parsing.c | 2 |
3 files changed, 7 insertions, 4 deletions
diff --git a/src/core/surface/call.c b/src/core/surface/call.c index aefcbad244..a1da822113 100644 --- a/src/core/surface/call.c +++ b/src/core/surface/call.c @@ -1373,7 +1373,8 @@ static void recv_metadata(grpc_call *call, grpc_metadata_batch *md) { l->md = 0; } } - if (gpr_time_cmp(md->deadline, gpr_inf_future(GPR_CLOCK_REALTIME)) != 0) { + if (gpr_time_cmp(md->deadline, gpr_inf_future(md->deadline.clock_type)) != + 0) { set_deadline_alarm(call, md->deadline); } if (!is_trailing) { diff --git a/src/core/surface/server.c b/src/core/surface/server.c index 24f35298ef..d3233cb3c8 100644 --- a/src/core/surface/server.c +++ b/src/core/surface/server.c @@ -530,6 +530,7 @@ static grpc_mdelem *server_filter(void *user_data, grpc_mdelem *md) { static void server_on_recv(void *ptr, int success) { grpc_call_element *elem = ptr; call_data *calld = elem->call_data; + gpr_timespec op_deadline; if (success && !calld->got_initial_metadata) { size_t i; @@ -539,8 +540,9 @@ static void server_on_recv(void *ptr, int success) { grpc_stream_op *op = &ops[i]; if (op->type != GRPC_OP_METADATA) continue; grpc_metadata_batch_filter(&op->data.metadata, server_filter, elem); - if (0 != gpr_time_cmp(op->data.metadata.deadline, - gpr_inf_future(GPR_CLOCK_REALTIME))) { + op_deadline = op->data.metadata.deadline; + if (0 != + gpr_time_cmp(op_deadline, gpr_inf_future(op_deadline.clock_type))) { calld->deadline = op->data.metadata.deadline; } calld->got_initial_metadata = 1; diff --git a/src/core/transport/chttp2/parsing.c b/src/core/transport/chttp2/parsing.c index 904b9afce7..50a2f752f6 100644 --- a/src/core/transport/chttp2/parsing.c +++ b/src/core/transport/chttp2/parsing.c @@ -607,7 +607,7 @@ static void on_header(void *tp, grpc_mdelem *md) { } grpc_chttp2_incoming_metadata_buffer_set_deadline( &stream_parsing->incoming_metadata, - gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), *cached_timeout)); + gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), *cached_timeout)); GRPC_MDELEM_UNREF(md); } else { grpc_chttp2_incoming_metadata_buffer_add(&stream_parsing->incoming_metadata, |