chromium/third_party/grpc/src/src/core/ext/filters/channel_idle/channel_idle_filter.cc

// Copyright 2022 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.

// TODO(ctiller): Add a unit test suite for these filters once it's practical to
// mock transport operations.

#include <grpc/support/port_platform.h>

#include "src/core/ext/filters/channel_idle/channel_idle_filter.h"

#include <stdlib.h>

#include <functional>
#include <utility>

#include "absl/types/optional.h"

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

#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/channel_stack_builder.h"
#include "src/core/lib/channel/promise_based_filter.h"
#include "src/core/lib/config/core_configuration.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/iomgr/closure.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/promise/exec_ctx_wakeup_scheduler.h"
#include "src/core/lib/promise/loop.h"
#include "src/core/lib/promise/poll.h"
#include "src/core/lib/promise/promise.h"
#include "src/core/lib/promise/sleep.h"
#include "src/core/lib/promise/try_seq.h"
#include "src/core/lib/surface/channel_init.h"
#include "src/core/lib/surface/channel_stack_type.h"
#include "src/core/lib/transport/http2_errors.h"

namespace grpc_core {

namespace {

// TODO(ctiller): The idle filter was disabled in client channel by default
// due to b/143502997. Now the bug is fixed enable the filter by default.
const auto kDefaultIdleTimeout =;

// If these settings change, make sure that we are not sending a GOAWAY for
// inproc transport, since a GOAWAY to inproc ends up destroying the transport.
const auto kDefaultMaxConnectionAge =;
const auto kDefaultMaxConnectionAgeGrace =;
const auto kDefaultMaxConnectionIdle =;
const auto kMaxConnectionAgeJitter =;

TraceFlag grpc_trace_client_idle_filter(false, "client_idle_filter");
}  // namespace

#define GRPC_IDLE_FILTER_LOG(format, ...)

namespace {

Duration GetClientIdleTimeout(const ChannelArgs& args) {}

}  // namespace

struct MaxAgeFilter::Config {};

absl::StatusOr<ClientIdleFilter> ClientIdleFilter::Create(
    const ChannelArgs& args, ChannelFilter::Args filter_args) {}

absl::StatusOr<MaxAgeFilter> MaxAgeFilter::Create(
    const ChannelArgs& args, ChannelFilter::Args filter_args) {}

void MaxAgeFilter::Shutdown() {}

void MaxAgeFilter::PostInit() {}

// Construct a promise for one call.
ArenaPromise<ServerMetadataHandle> ChannelIdleFilter::MakeCallPromise(
    CallArgs call_args, NextPromiseFactory next_promise_factory) {}

bool ChannelIdleFilter::StartTransportOp(grpc_transport_op* op) {}

void ChannelIdleFilter::Shutdown() {}

void ChannelIdleFilter::IncreaseCallCount() {}

void ChannelIdleFilter::DecreaseCallCount() {}

void ChannelIdleFilter::StartIdleTimer() {}

void ChannelIdleFilter::CloseChannel() {}

const grpc_channel_filter ClientIdleFilter::kFilter =;
const grpc_channel_filter MaxAgeFilter::kFilter =;

void RegisterChannelIdleFilters(CoreConfiguration::Builder* builder) {}

MaxAgeFilter::MaxAgeFilter(grpc_channel_stack* channel_stack,
                           const Config& max_age_config)
    :{}

}  // namespace grpc_core