From 5cf3c372ddafee6ee907e2b709e907d1dcd17f51 Mon Sep 17 00:00:00 2001
From: David Garcia Quintas <dgq@google.com>
Date: Mon, 3 Oct 2016 14:30:03 -0700
Subject: [PATCH] Back to using inf future lor LB call deadline

---
 src/core/ext/client_config/client_channel.c | 4 +++-
 src/core/ext/client_config/lb_policy.h      | 2 +-
 src/core/ext/lb_policy/grpclb/grpclb.c      | 8 ++------
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/core/ext/client_config/client_channel.c b/src/core/ext/client_config/client_channel.c
index 0c1b2445bf..3133869e22 100644
--- a/src/core/ext/client_config/client_channel.c
+++ b/src/core/ext/client_config/client_channel.c
@@ -602,9 +602,11 @@ static bool pick_subchannel(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
     int r;
     GRPC_LB_POLICY_REF(lb_policy, "pick_subchannel");
     gpr_mu_unlock(&chand->mu);
+    // TODO(dgq): use deadline for service config instead of inf_future for the
+    // pick's deadline.
     const grpc_lb_policy_pick_args inputs = {
         calld->pollent, initial_metadata, initial_metadata_flags,
-        &calld->lb_token_mdelem, calld->deadline};
+        &calld->lb_token_mdelem, gpr_inf_future(GPR_CLOCK_MONOTONIC)};
     r = grpc_lb_policy_pick(exec_ctx, lb_policy, &inputs, connected_subchannel,
                             NULL, on_ready);
     GRPC_LB_POLICY_UNREF(exec_ctx, lb_policy, "pick_subchannel");
diff --git a/src/core/ext/client_config/lb_policy.h b/src/core/ext/client_config/lb_policy.h
index 376bb2da63..6cc3e1ebd3 100644
--- a/src/core/ext/client_config/lb_policy.h
+++ b/src/core/ext/client_config/lb_policy.h
@@ -65,7 +65,7 @@ typedef struct grpc_lb_policy_pick_args {
   uint32_t initial_metadata_flags;
   /** Storage for LB token in \a initial_metadata, or NULL if not used */
   grpc_linked_mdelem *lb_token_mdelem_storage;
-  /** Deadline associated with the picking call. */
+  /** Deadline for the call to the LB server */
   gpr_timespec deadline;
 } grpc_lb_policy_pick_args;
 
diff --git a/src/core/ext/lb_policy/grpclb/grpclb.c b/src/core/ext/lb_policy/grpclb/grpclb.c
index 76cc08ecc9..63af774ea6 100644
--- a/src/core/ext/lb_policy/grpclb/grpclb.c
+++ b/src/core/ext/lb_policy/grpclb/grpclb.c
@@ -275,7 +275,7 @@ typedef struct glb_lb_policy {
   const char *server_name;
   grpc_client_channel_factory *cc_factory;
 
-  /** deadline for the original client's call */
+  /** deadline for the LB's call */
   gpr_timespec deadline;
 
   /** for communicating with the LB server */
@@ -766,10 +766,7 @@ static int glb_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
 
   glb_lb_policy *glb_policy = (glb_lb_policy *)pol;
   gpr_mu_lock(&glb_policy->mu);
-  /* use the longest deadline across incoming calls for the communication with
-   * the LB server */
-  glb_policy->deadline =
-      gpr_time_max(pick_args->deadline, glb_policy->deadline);
+  glb_policy->deadline = pick_args->deadline;
   bool pick_done;
 
   if (glb_policy->rr_policy != NULL) {
@@ -930,7 +927,6 @@ static lb_client_data *lb_client_data_create(glb_lb_policy *glb_policy) {
   grpc_closure_init(&lb_client->close_sent, close_sent_cb, lb_client);
   grpc_closure_init(&lb_client->srv_status_rcvd, srv_status_rcvd_cb, lb_client);
 
-  /* the longest deadline across incoming calls */
   lb_client->deadline = glb_policy->deadline;
 
   /* Note the following LB call progresses every time there's activity in \a
-- 
GitLab