Fix SIGV when grpc_channel_stack_init returns errors

pull/12732/head
Yuchen Zeng 8 years ago
parent d573861506
commit 6f9985e551
  1. 4
      src/core/ext/filters/client_channel/backup_poller.cc
  2. 2
      src/core/ext/filters/client_channel/client_channel.cc

@ -48,8 +48,8 @@ static gpr_once g_once = GPR_ONCE_INIT;
static gpr_mu g_poller_mu;
static backup_poller* g_poller = NULL; // guarded by g_poller_mu
// g_poll_interval_ms is set only once at the first time
// grpc_client_channel_start_backup_polling() is call, after that it is treated
// as const.
// grpc_client_channel_start_backup_polling() is called, after that it is
// treated as const.
static int g_poll_interval_ms = DEFAULT_POLL_INTERVAL_MS;
static void init_globals() {

@ -713,6 +713,7 @@ static grpc_error *cc_init_channel_elem(grpc_exec_ctx *exec_ctx,
chand->interested_parties = grpc_pollset_set_create();
grpc_connectivity_state_init(&chand->state_tracker, GRPC_CHANNEL_IDLE,
"client_channel");
grpc_client_channel_start_backup_polling(exec_ctx, chand->interested_parties);
// Record client channel factory.
const grpc_arg *arg = grpc_channel_args_find(args->channel_args,
GRPC_ARG_CLIENT_CHANNEL_FACTORY);
@ -754,7 +755,6 @@ static grpc_error *cc_init_channel_elem(grpc_exec_ctx *exec_ctx,
}
chand->deadline_checking_enabled =
grpc_deadline_checking_enabled(args->channel_args);
grpc_client_channel_start_backup_polling(exec_ctx, chand->interested_parties);
return GRPC_ERROR_NONE;
}

Loading…
Cancel
Save