aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/ext/lb_policy/round_robin
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2016-04-27 18:40:50 -0700
committerGravatar David Garcia Quintas <dgq@google.com>2016-04-27 18:40:50 -0700
commitd312a0b866b0223bf9d5a2c88530a5cd7005c990 (patch)
treef13b5748c9d83c6177b8ae6f22422af29ef9d803 /src/core/ext/lb_policy/round_robin
parent879b3b9efa634ab683fccc96261af6e7838e6b31 (diff)
Smarter pollset/pollset_set propagation
For some definition of "smart"... client_channel simply passes along pollset/pollset_set, removing the need to instantiate a pollset_set in the subchannel_call_holder: it's now up to the LB policies to handle the pollset/pollset_set.
Diffstat (limited to 'src/core/ext/lb_policy/round_robin')
-rw-r--r--src/core/ext/lb_policy/round_robin/round_robin.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/core/ext/lb_policy/round_robin/round_robin.c b/src/core/ext/lb_policy/round_robin/round_robin.c
index 78ac61923f..f4e3d60a83 100644
--- a/src/core/ext/lb_policy/round_robin/round_robin.c
+++ b/src/core/ext/lb_policy/round_robin/round_robin.c
@@ -36,6 +36,7 @@
#include <grpc/support/alloc.h>
#include "src/core/ext/client_config/lb_policy_registry.h"
+#include "src/core/ext/lb_policy/common.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/transport/connectivity_state.h"
@@ -48,7 +49,8 @@ int grpc_lb_round_robin_trace = 0;
* Once a pick is available, \a target is updated and \a on_complete called. */
typedef struct pending_pick {
struct pending_pick *next;
- grpc_pollset_set *pollset_set;
+ grpc_pollset *pollset;
+ grpc_pollset_set *pollset_set_alternative;
uint32_t initial_metadata_flags;
grpc_connected_subchannel **target;
grpc_closure *on_complete;
@@ -262,8 +264,9 @@ static void rr_cancel_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
while (pp != NULL) {
pending_pick *next = pp->next;
if (pp->target == target) {
- grpc_pollset_set_del_pollset_set(exec_ctx, p->base.interested_parties,
- pp->pollset_set);
+ del_pollset_or_pollset_set_alternative(
+ exec_ctx, p->base.interested_parties, pp->pollset,
+ pp->pollset_set_alternative);
*target = NULL;
grpc_exec_ctx_enqueue(exec_ctx, pp->on_complete, false, NULL);
gpr_free(pp);
@@ -288,8 +291,9 @@ static void rr_cancel_picks(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
pending_pick *next = pp->next;
if ((pp->initial_metadata_flags & initial_metadata_flags_mask) ==
initial_metadata_flags_eq) {
- grpc_pollset_set_del_pollset_set(exec_ctx, p->base.interested_parties,
- pp->pollset_set);
+ del_pollset_or_pollset_set_alternative(
+ exec_ctx, p->base.interested_parties, pp->pollset,
+ pp->pollset_set_alternative);
*pp->target = NULL;
grpc_exec_ctx_enqueue(exec_ctx, pp->on_complete, false, NULL);
gpr_free(pp);
@@ -329,7 +333,8 @@ static void rr_exit_idle(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) {
}
static int rr_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
- grpc_pollset_set *pollset_set,
+ grpc_pollset *pollset,
+ grpc_pollset_set *pollset_set_alternative,
grpc_metadata_batch *initial_metadata,
uint32_t initial_metadata_flags,
grpc_connected_subchannel **target,
@@ -353,11 +358,12 @@ static int rr_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
if (!p->started_picking) {
start_picking(exec_ctx, p);
}
- grpc_pollset_set_add_pollset_set(exec_ctx, p->base.interested_parties,
- pollset_set);
+ add_pollset_or_pollset_set_alternative(exec_ctx, p->base.interested_parties,
+ pollset, pollset_set_alternative);
pp = gpr_malloc(sizeof(*pp));
pp->next = p->pending_picks;
- pp->pollset_set = pollset_set;
+ pp->pollset = pollset;
+ pp->pollset_set_alternative = pollset_set_alternative;
pp->target = target;
pp->on_complete = on_complete;
pp->initial_metadata_flags = initial_metadata_flags;
@@ -406,8 +412,9 @@ static void rr_connectivity_changed(grpc_exec_ctx *exec_ctx, void *arg,
"[RR CONN CHANGED] TARGET <-- SUBCHANNEL %p (NODE %p)",
selected->subchannel, selected);
}
- grpc_pollset_set_del_pollset_set(exec_ctx, p->base.interested_parties,
- pp->pollset_set);
+ del_pollset_or_pollset_set_alternative(
+ exec_ctx, p->base.interested_parties, pp->pollset,
+ pp->pollset_set_alternative);
grpc_exec_ctx_enqueue(exec_ctx, pp->on_complete, true, NULL);
gpr_free(pp);
}