diff options
author | 2016-03-11 12:54:40 -0800 | |
---|---|---|
committer | 2016-03-11 12:54:40 -0800 | |
commit | 476bb3b8d5b3a9d132ac2db6438e778167f2a51a (patch) | |
tree | c5ab183bf509e8eb57a70b40e15b9edd81f97c38 /src/core/support | |
parent | 48eaab0a165e665de0a1e98c8ab60ab754eb0f23 (diff) |
Integrate backoff library with dns retries
Diffstat (limited to 'src/core/support')
-rw-r--r-- | src/core/support/backoff.c | 5 | ||||
-rw-r--r-- | src/core/support/backoff.h | 3 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/core/support/backoff.c b/src/core/support/backoff.c index 7458219645..4ccfb774ed 100644 --- a/src/core/support/backoff.c +++ b/src/core/support/backoff.c @@ -69,3 +69,8 @@ gpr_timespec gpr_backoff_step(gpr_backoff *backoff, gpr_timespec now) { return gpr_time_add( now, gpr_time_from_millis(backoff->current_timeout_millis, GPR_TIMESPAN)); } + +void gpr_backoff_reset(gpr_backoff *backoff) { + // forces step() to return a timeout of min_timeout_millis + backoff->current_timeout_millis = 0; +} diff --git a/src/core/support/backoff.h b/src/core/support/backoff.h index 3234aa214d..232a28d48c 100644 --- a/src/core/support/backoff.h +++ b/src/core/support/backoff.h @@ -61,5 +61,8 @@ void gpr_backoff_init(gpr_backoff *backoff, double multiplier, double jitter, gpr_timespec gpr_backoff_begin(gpr_backoff *backoff, gpr_timespec now); /// Step a retry loop: returns a timespec for the NEXT retry gpr_timespec gpr_backoff_step(gpr_backoff *backoff, gpr_timespec now); +/// Reset the backoff, so the next gpr_backoff_step will be a gpr_backoff_begin +/// instead +void gpr_backoff_reset(gpr_backoff *backoff); #endif // GRPC_INTERNAL_CORE_SUPPORT_BACKOFF_H |