Sha256: b3d98ff1fdb56c62468c2d209b49d92edd821cd57cd4ccf5706d3b952d4ab99c

Contents?: true

Size: 1.96 KB

Versions: 16

Compression:

Stored size: 1.96 KB

Contents

/*
 *
 * Copyright 2015 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/lb_policy.h"
#include "src/core/lib/iomgr/combiner.h"

grpc_core::DebugOnlyTraceFlag grpc_trace_lb_policy_refcount(
    false, "lb_policy_refcount");

namespace grpc_core {

LoadBalancingPolicy::LoadBalancingPolicy(const Args& args)
    : InternallyRefCountedWithTracing(&grpc_trace_lb_policy_refcount),
      combiner_(GRPC_COMBINER_REF(args.combiner, "lb_policy")),
      client_channel_factory_(args.client_channel_factory),
      interested_parties_(grpc_pollset_set_create()),
      request_reresolution_(nullptr) {}

LoadBalancingPolicy::~LoadBalancingPolicy() {
  grpc_pollset_set_destroy(interested_parties_);
  GRPC_COMBINER_UNREF(combiner_, "lb_policy");
}

void LoadBalancingPolicy::TryReresolutionLocked(
    grpc_core::TraceFlag* grpc_lb_trace, grpc_error* error) {
  if (request_reresolution_ != nullptr) {
    GRPC_CLOSURE_SCHED(request_reresolution_, error);
    request_reresolution_ = nullptr;
    if (grpc_lb_trace->enabled()) {
      gpr_log(GPR_INFO,
              "%s %p: scheduling re-resolution closure with error=%s.",
              grpc_lb_trace->name(), this, grpc_error_string(error));
    }
  } else {
    if (grpc_lb_trace->enabled()) {
      gpr_log(GPR_INFO, "%s %p: no available re-resolution closure.",
              grpc_lb_trace->name(), this);
    }
  }
}

}  // namespace grpc_core

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
grpc-1.17.1 src/core/ext/filters/client_channel/lb_policy.cc
grpc-1.17.0 src/core/ext/filters/client_channel/lb_policy.cc
grpc-1.17.0.pre1 src/core/ext/filters/client_channel/lb_policy.cc
grpc-1.16.0 src/core/ext/filters/client_channel/lb_policy.cc
grpc-flamingo-1.15.0 src/core/ext/filters/client_channel/lb_policy.cc
grpc-1.16.0.pre1 src/core/ext/filters/client_channel/lb_policy.cc
grpc-1.15.0 src/core/ext/filters/client_channel/lb_policy.cc
grpc-1.14.2 src/core/ext/filters/client_channel/lb_policy.cc
grpc-1.15.0.pre1 src/core/ext/filters/client_channel/lb_policy.cc
grpc-1.14.2.pre1 src/core/ext/filters/client_channel/lb_policy.cc
grpc-1.14.1 src/core/ext/filters/client_channel/lb_policy.cc
grpc-1.14.0 src/core/ext/filters/client_channel/lb_policy.cc
grpc-1.13.0 src/core/ext/filters/client_channel/lb_policy.cc
grpc-1.13.0.pre3 src/core/ext/filters/client_channel/lb_policy.cc
grpc-1.13.0.pre1 src/core/ext/filters/client_channel/lb_policy.cc
grpc-1.12.0 src/core/ext/filters/client_channel/lb_policy.cc