chromium/third_party/grpc/src/src/core/ext/filters/client_channel/backup_poller.cc

//
//
// Copyright 2017 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//

#include <grpc/support/port_platform.h>

#include "src/core/ext/filters/client_channel/backup_poller.h"

#include <inttypes.h>

#include "absl/status/status.h"

#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>

#include "src/core/lib/gprpp/global_config.h"
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/gprpp/time.h"
#include "src/core/lib/iomgr/closure.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/iomgr.h"
#include "src/core/lib/iomgr/pollset.h"
#include "src/core/lib/iomgr/pollset_set.h"
#include "src/core/lib/iomgr/timer.h"

#define DEFAULT_POLL_INTERVAL_MS

namespace {
struct backup_poller {};
}  // namespace

static gpr_mu g_poller_mu;
static backup_poller* g_poller =;  // guarded by g_poller_mu
// g_poll_interval_ms is set only once at the first time
// grpc_client_channel_start_backup_polling() is called, after that it is
// treated as const.
static grpc_core::Duration g_poll_interval =;

GPR_GLOBAL_CONFIG_DEFINE_INT32(
    grpc_client_channel_backup_poll_interval_ms, DEFAULT_POLL_INTERVAL_MS,
    "Declares the interval in ms between two backup polls on client channels. "
    "These polls are run in the timer thread so that gRPC can process "
    "connection failures while there is no active polling thread. "
    "They help reconnect disconnected client channels (mostly due to "
    "idleness), so that the next RPC on this channel won't fail. Set to 0 to "
    "turn off the backup polls.");

void grpc_client_channel_global_init_backup_polling() {}

static void backup_poller_shutdown_unref(backup_poller* p) {}

static void done_poller(void* arg, grpc_error_handle /*error*/) {}

static void g_poller_unref() {}

static void run_poller(void* arg, grpc_error_handle error) {}

static void g_poller_init_locked() {}

void grpc_client_channel_start_backup_polling(
    grpc_pollset_set* interested_parties) {}

void grpc_client_channel_stop_backup_polling(
    grpc_pollset_set* interested_parties) {}