|
|
@ -57,8 +57,19 @@ static backup_poller* g_poller = nullptr; // guarded by g_poller_mu |
|
|
|
// treated as const.
|
|
|
|
// treated as const.
|
|
|
|
static grpc_core::Duration g_poll_interval = |
|
|
|
static grpc_core::Duration g_poll_interval = |
|
|
|
grpc_core::Duration::Milliseconds(DEFAULT_POLL_INTERVAL_MS); |
|
|
|
grpc_core::Duration::Milliseconds(DEFAULT_POLL_INTERVAL_MS); |
|
|
|
|
|
|
|
// TODO(hork): delete the backup poller when EventEngine is rolled out
|
|
|
|
|
|
|
|
// everywhere.
|
|
|
|
|
|
|
|
static bool g_backup_polling_disabled; |
|
|
|
|
|
|
|
|
|
|
|
void grpc_client_channel_global_init_backup_polling() { |
|
|
|
void grpc_client_channel_global_init_backup_polling() { |
|
|
|
|
|
|
|
// Disable backup polling if EventEngine is used everywhere.
|
|
|
|
|
|
|
|
g_backup_polling_disabled = grpc_core::IsEventEngineClientEnabled() && |
|
|
|
|
|
|
|
grpc_core::IsEventEngineListenerEnabled() && |
|
|
|
|
|
|
|
grpc_core::IsEventEngineDnsEnabled(); |
|
|
|
|
|
|
|
if (g_backup_polling_disabled) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
gpr_mu_init(&g_poller_mu); |
|
|
|
gpr_mu_init(&g_poller_mu); |
|
|
|
int32_t poll_interval_ms = |
|
|
|
int32_t poll_interval_ms = |
|
|
|
grpc_core::ConfigVars::Get().ClientChannelBackupPollIntervalMs(); |
|
|
|
grpc_core::ConfigVars::Get().ClientChannelBackupPollIntervalMs(); |
|
|
@ -146,7 +157,8 @@ static void g_poller_init_locked() { |
|
|
|
|
|
|
|
|
|
|
|
void grpc_client_channel_start_backup_polling( |
|
|
|
void grpc_client_channel_start_backup_polling( |
|
|
|
grpc_pollset_set* interested_parties) { |
|
|
|
grpc_pollset_set* interested_parties) { |
|
|
|
if (g_poll_interval == grpc_core::Duration::Zero() || |
|
|
|
if (g_backup_polling_disabled || |
|
|
|
|
|
|
|
g_poll_interval == grpc_core::Duration::Zero() || |
|
|
|
grpc_iomgr_run_in_background()) { |
|
|
|
grpc_iomgr_run_in_background()) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -165,7 +177,8 @@ void grpc_client_channel_start_backup_polling( |
|
|
|
|
|
|
|
|
|
|
|
void grpc_client_channel_stop_backup_polling( |
|
|
|
void grpc_client_channel_stop_backup_polling( |
|
|
|
grpc_pollset_set* interested_parties) { |
|
|
|
grpc_pollset_set* interested_parties) { |
|
|
|
if (g_poll_interval == grpc_core::Duration::Zero() || |
|
|
|
if (g_backup_polling_disabled || |
|
|
|
|
|
|
|
g_poll_interval == grpc_core::Duration::Zero() || |
|
|
|
grpc_iomgr_run_in_background()) { |
|
|
|
grpc_iomgr_run_in_background()) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|