Spam cleanup, properly shut down lb_policy

pull/2303/head
Craig Tiller 10 years ago
parent 6806e1e526
commit d2cc45970b
  1. 3
      src/core/channel/client_channel.c
  2. 12
      src/core/client_config/lb_policies/pick_first.c
  3. 4
      src/core/client_config/subchannel.c
  4. 1
      src/core/iomgr/fd_posix.c

@ -436,6 +436,9 @@ static void cc_start_transport_op(grpc_channel_element *elem,
GRPC_CHANNEL_FATAL_FAILURE); GRPC_CHANNEL_FATAL_FAILURE);
destroy_resolver = chand->resolver; destroy_resolver = chand->resolver;
chand->resolver = NULL; chand->resolver = NULL;
if (chand->lb_policy != NULL) {
grpc_lb_policy_shutdown(chand->lb_policy);
}
} }
if (!is_empty(op, sizeof(*op))) { if (!is_empty(op, sizeof(*op))) {

@ -85,8 +85,16 @@ void pf_destroy(grpc_lb_policy *pol) {
} }
void pf_shutdown(grpc_lb_policy *pol) { void pf_shutdown(grpc_lb_policy *pol) {
/* pick_first_lb_policy *p = (pick_first_lb_policy*)pol; */ pick_first_lb_policy *p = (pick_first_lb_policy*)pol;
abort(); pending_pick *pp;
gpr_mu_lock(&p->mu);
while ((pp = p->pending_picks)) {
p->pending_picks = pp->next;
*pp->target = NULL;
grpc_iomgr_add_delayed_callback(pp->on_complete, 0);
gpr_free(pp);
}
gpr_mu_unlock(&p->mu);
} }
void pf_pick(grpc_lb_policy *pol, grpc_pollset *pollset, void pf_pick(grpc_lb_policy *pol, grpc_pollset *pollset,

@ -562,6 +562,9 @@ static void on_alarm(void *arg, int iomgr_success) {
grpc_subchannel *c = arg; grpc_subchannel *c = arg;
gpr_mu_lock(&c->mu); gpr_mu_lock(&c->mu);
c->have_alarm = 0; c->have_alarm = 0;
if (c->disconnected) {
iomgr_success = 0;
}
connectivity_state_changed_locked(c); connectivity_state_changed_locked(c);
gpr_mu_unlock(&c->mu); gpr_mu_unlock(&c->mu);
if (iomgr_success) { if (iomgr_success) {
@ -609,7 +612,6 @@ static grpc_connectivity_state compute_connectivity_locked(grpc_subchannel *c) {
static void connectivity_state_changed_locked(grpc_subchannel *c) { static void connectivity_state_changed_locked(grpc_subchannel *c) {
grpc_connectivity_state current = compute_connectivity_locked(c); grpc_connectivity_state current = compute_connectivity_locked(c);
gpr_log(GPR_DEBUG, "SUBCHANNEL constate=%d", current);
grpc_connectivity_state_set(&c->state_tracker, current); grpc_connectivity_state_set(&c->state_tracker, current);
} }

@ -159,7 +159,6 @@ void grpc_fd_global_shutdown(void) {
grpc_fd *grpc_fd_create(int fd, const char *name) { grpc_fd *grpc_fd_create(int fd, const char *name) {
grpc_fd *r = alloc_fd(fd); grpc_fd *r = alloc_fd(fd);
gpr_log(GPR_DEBUG, "FD %d %p create", r->fd, r);
grpc_iomgr_register_object(&r->iomgr_object, name); grpc_iomgr_register_object(&r->iomgr_object, name);
return r; return r;
} }

Loading…
Cancel
Save