Skip to content
This repository has been archived by the owner on Nov 6, 2023. It is now read-only.

Commit

Permalink
PollingResolver: Honor cancel action in Timer callback (grpc#31826)
Browse files Browse the repository at this point in the history
* reset timer handle when cancel failed, meaning the timer callback has
already been scheduled

* review

* review
  • Loading branch information
yijiem authored Dec 8, 2022
1 parent b19604e commit 89f3b1f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/core/ext/filters/client_channel/resolver/polling_resolver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,11 @@ void PollingResolver::RequestReresolutionLocked() {
}

void PollingResolver::ResetBackoffLocked() {
MaybeCancelNextResolutionTimer();
backoff_.Reset();
if (next_resolution_timer_handle_.has_value()) {
MaybeCancelNextResolutionTimer();
StartResolvingLocked();
}
}

void PollingResolver::ShutdownLocked() {
Expand Down Expand Up @@ -121,8 +124,9 @@ void PollingResolver::OnNextResolutionLocked() {
"[polling resolver %p] re-resolution timer fired: shutdown_=%d",
this, shutdown_);
}
next_resolution_timer_handle_.reset();
if (!shutdown_) {
// If we haven't been cancelled nor shutdown, then start resolving.
if (next_resolution_timer_handle_.has_value() && !shutdown_) {
next_resolution_timer_handle_.reset();
StartResolvingLocked();
}
}
Expand Down

0 comments on commit 89f3b1f

Please sign in to comment.