diff options
author | Craig Tiller <ctiller@google.com> | 2016-12-14 11:07:56 -0800 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2016-12-14 11:07:56 -0800 |
commit | 8735891b41ddc66dc3fce2188874616d8d536b95 (patch) | |
tree | d605e4f691d33538deb0993644f60a9fac506e67 /src/core | |
parent | 1b0d2f008bb13cea43928a6aa2cbf605f9c95aab (diff) | |
parent | f748b0ab77521bf962196e0d3aa2fdb3bf4d10af (diff) |
Merge branch 'slice_with_exec_ctx' into metadata_filter
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/ext/client_channel/client_channel.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/core/ext/client_channel/client_channel.c b/src/core/ext/client_channel/client_channel.c index 8929e8c48a..8493c1def8 100644 --- a/src/core/ext/client_channel/client_channel.c +++ b/src/core/ext/client_channel/client_channel.c @@ -688,9 +688,15 @@ static void subchannel_ready(grpc_exec_ctx *exec_ctx, void *arg, "Failed to create subchannel", &error, 1)); } else if (GET_CALL(calld) == CANCELLED_CALL) { /* already cancelled before subchannel became ready */ - fail_locked(exec_ctx, calld, - GRPC_ERROR_CREATE_REFERENCING( - "Cancelled before creating subchannel", &error, 1)); + grpc_error *cancellation_error = GRPC_ERROR_CREATE_REFERENCING( + "Cancelled before creating subchannel", &error, 1); + /* if due to deadline, attach the deadline exceeded status to the error */ + if (gpr_time_cmp(calld->deadline, gpr_now(GPR_CLOCK_MONOTONIC)) < 0) { + cancellation_error = + grpc_error_set_int(cancellation_error, GRPC_ERROR_INT_GRPC_STATUS, + GRPC_STATUS_DEADLINE_EXCEEDED); + } + fail_locked(exec_ctx, calld, cancellation_error); } else { /* Create call on subchannel. */ grpc_subchannel_call *subchannel_call = NULL; @@ -814,7 +820,6 @@ static bool pick_subchannel(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, initial_metadata_flags &= ~GRPC_INITIAL_METADATA_WAIT_FOR_READY; } } - // TODO(dgq): make this deadline configurable somehow. const grpc_lb_policy_pick_args inputs = { initial_metadata, initial_metadata_flags, &calld->lb_token_mdelem, gpr_inf_future(GPR_CLOCK_MONOTONIC)}; |