|
|
|
@ -156,33 +156,29 @@ class XdsResolver : public Resolver { |
|
|
|
|
explicit ListenerWatcher(RefCountedPtr<XdsResolver> resolver) |
|
|
|
|
: resolver_(std::move(resolver)) {} |
|
|
|
|
void OnResourceChanged(XdsListenerResource listener) override { |
|
|
|
|
Ref().release(); // ref held by lambda
|
|
|
|
|
RefCountedPtr<ListenerWatcher> self = Ref(); |
|
|
|
|
resolver_->work_serializer_->Run( |
|
|
|
|
// TODO(yashykt): When we move to C++14, capture listener with
|
|
|
|
|
// std::move
|
|
|
|
|
[this, listener]() mutable { |
|
|
|
|
resolver_->OnListenerUpdate(std::move(listener)); |
|
|
|
|
Unref(); |
|
|
|
|
[self = std::move(self), listener = std::move(listener)]() mutable { |
|
|
|
|
self->resolver_->OnListenerUpdate(std::move(listener)); |
|
|
|
|
}, |
|
|
|
|
DEBUG_LOCATION); |
|
|
|
|
} |
|
|
|
|
void OnError(absl::Status status) override { |
|
|
|
|
Ref().release(); // ref held by lambda
|
|
|
|
|
RefCountedPtr<ListenerWatcher> self = Ref(); |
|
|
|
|
resolver_->work_serializer_->Run( |
|
|
|
|
[this, status]() { |
|
|
|
|
resolver_->OnError(resolver_->lds_resource_name_, status); |
|
|
|
|
Unref(); |
|
|
|
|
[self = std::move(self), status = std::move(status)]() mutable { |
|
|
|
|
self->resolver_->OnError(self->resolver_->lds_resource_name_, |
|
|
|
|
std::move(status)); |
|
|
|
|
}, |
|
|
|
|
DEBUG_LOCATION); |
|
|
|
|
} |
|
|
|
|
void OnResourceDoesNotExist() override { |
|
|
|
|
Ref().release(); // ref held by lambda
|
|
|
|
|
RefCountedPtr<ListenerWatcher> self = Ref(); |
|
|
|
|
resolver_->work_serializer_->Run( |
|
|
|
|
[this]() { |
|
|
|
|
resolver_->OnResourceDoesNotExist( |
|
|
|
|
absl::StrCat(resolver_->lds_resource_name_, |
|
|
|
|
[self = std::move(self)]() { |
|
|
|
|
self->resolver_->OnResourceDoesNotExist( |
|
|
|
|
absl::StrCat(self->resolver_->lds_resource_name_, |
|
|
|
|
": xDS listener resource does not exist")); |
|
|
|
|
Unref(); |
|
|
|
|
}, |
|
|
|
|
DEBUG_LOCATION); |
|
|
|
|
} |
|
|
|
@ -197,33 +193,33 @@ class XdsResolver : public Resolver { |
|
|
|
|
explicit RouteConfigWatcher(RefCountedPtr<XdsResolver> resolver) |
|
|
|
|
: resolver_(std::move(resolver)) {} |
|
|
|
|
void OnResourceChanged(XdsRouteConfigResource route_config) override { |
|
|
|
|
Ref().release(); // ref held by lambda
|
|
|
|
|
RefCountedPtr<RouteConfigWatcher> self = Ref(); |
|
|
|
|
resolver_->work_serializer_->Run( |
|
|
|
|
// TODO(yashykt): When we move to C++14, capture route_config with
|
|
|
|
|
// std::move
|
|
|
|
|
[this, route_config]() mutable { |
|
|
|
|
resolver_->OnRouteConfigUpdate(std::move(route_config)); |
|
|
|
|
Unref(); |
|
|
|
|
[self = std::move(self), |
|
|
|
|
route_config = std::move(route_config)]() mutable { |
|
|
|
|
if (self != self->resolver_->route_config_watcher_) return; |
|
|
|
|
self->resolver_->OnRouteConfigUpdate(std::move(route_config)); |
|
|
|
|
}, |
|
|
|
|
DEBUG_LOCATION); |
|
|
|
|
} |
|
|
|
|
void OnError(absl::Status status) override { |
|
|
|
|
Ref().release(); // ref held by lambda
|
|
|
|
|
RefCountedPtr<RouteConfigWatcher> self = Ref(); |
|
|
|
|
resolver_->work_serializer_->Run( |
|
|
|
|
[this, status]() { |
|
|
|
|
resolver_->OnError(resolver_->route_config_name_, status); |
|
|
|
|
Unref(); |
|
|
|
|
[self = std::move(self), status = std::move(status)]() mutable { |
|
|
|
|
if (self != self->resolver_->route_config_watcher_) return; |
|
|
|
|
self->resolver_->OnError(self->resolver_->route_config_name_, |
|
|
|
|
std::move(status)); |
|
|
|
|
}, |
|
|
|
|
DEBUG_LOCATION); |
|
|
|
|
} |
|
|
|
|
void OnResourceDoesNotExist() override { |
|
|
|
|
Ref().release(); // ref held by lambda
|
|
|
|
|
RefCountedPtr<RouteConfigWatcher> self = Ref(); |
|
|
|
|
resolver_->work_serializer_->Run( |
|
|
|
|
[this]() { |
|
|
|
|
resolver_->OnResourceDoesNotExist(absl::StrCat( |
|
|
|
|
resolver_->route_config_name_, |
|
|
|
|
[self = std::move(self)]() { |
|
|
|
|
if (self != self->resolver_->route_config_watcher_) return; |
|
|
|
|
self->resolver_->OnResourceDoesNotExist(absl::StrCat( |
|
|
|
|
self->resolver_->route_config_name_, |
|
|
|
|
": xDS route configuration resource does not exist")); |
|
|
|
|
Unref(); |
|
|
|
|
}, |
|
|
|
|
DEBUG_LOCATION); |
|
|
|
|
} |
|
|
|
|