Remaning one from xds_client

reviewable/pr20542/r1
Yash Tibrewal 5 years ago
parent 5f22055d0d
commit 8610a64ec9
  1. 6
      src/core/ext/filters/client_channel/xds/xds_client.cc
  2. 15
      src/core/lib/transport/connectivity_state.cc
  3. 4
      src/core/lib/transport/connectivity_state.h

@ -298,12 +298,12 @@ class XdsClient::ChannelState::StateWatcher
: public AsyncConnectivityStateWatcherInterface {
public:
explicit StateWatcher(RefCountedPtr<ChannelState> parent)
: AsyncConnectivityStateWatcherInterface(
grpc_combiner_scheduler(parent->xds_client()->combiner_)),
: AsyncConnectivityStateWatcherInterface(parent->xds_client()->combiner_),
parent_(std::move(parent)) {}
private:
void OnConnectivityStateChange(grpc_connectivity_state new_state) override {
void OnConnectivityStateChange(
grpc_connectivity_state new_state) override {
if (!parent_->shutting_down_ &&
new_state == GRPC_CHANNEL_TRANSIENT_FAILURE) {
// In TRANSIENT_FAILURE. Notify all watchers of error.

@ -57,10 +57,17 @@ const char* ConnectivityStateName(grpc_connectivity_state state) {
class AsyncConnectivityStateWatcherInterface::Notifier {
public:
Notifier(RefCountedPtr<AsyncConnectivityStateWatcherInterface> watcher,
grpc_connectivity_state state, grpc_closure_scheduler* scheduler)
grpc_connectivity_state state, grpc_core::Combiner* combiner)
: watcher_(std::move(watcher)), state_(state) {
GRPC_CLOSURE_INIT(&closure_, SendNotification, this, scheduler);
GRPC_CLOSURE_SCHED(&closure_, GRPC_ERROR_NONE);
if (combiner != nullptr) {
combiner->Run(
GRPC_CLOSURE_INIT(&closure_, SendNotification, this, nullptr),
GRPC_ERROR_NONE);
} else {
GRPC_CLOSURE_INIT(&closure_, SendNotification, this,
grpc_schedule_on_exec_ctx);
GRPC_CLOSURE_SCHED(&closure_, GRPC_ERROR_NONE);
}
}
private:
@ -81,7 +88,7 @@ class AsyncConnectivityStateWatcherInterface::Notifier {
void AsyncConnectivityStateWatcherInterface::Notify(
grpc_connectivity_state state) {
New<Notifier>(Ref(), state, scheduler_); // Deletes itself when done.
New<Notifier>(Ref(), state, combiner_); // Deletes itself when done.
}
//

@ -69,8 +69,8 @@ class AsyncConnectivityStateWatcherInterface
class Notifier;
explicit AsyncConnectivityStateWatcherInterface(
grpc_closure_scheduler* scheduler = grpc_schedule_on_exec_ctx)
: scheduler_(scheduler) {}
grpc_core::Combiner* combiner = nullptr)
: combiner_(combiner) {}
// Invoked asynchronously when Notify() is called.
virtual void OnConnectivityStateChange(grpc_connectivity_state new_state) = 0;

Loading…
Cancel
Save