aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/backoff
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2017-11-03 09:09:36 -0700
committerGravatar Craig Tiller <ctiller@google.com>2017-11-03 09:09:36 -0700
commitbaa14a975ef92ee6fb301f0e684f56f18f2c55a7 (patch)
tree9a6cb2df58fe175e8abfccf2cbd40349726e46f3 /src/core/lib/backoff
parentef68fe7239a89095f1eaa89c1dd28b2b7be2a3c7 (diff)
Update clang-format to 5.0
Diffstat (limited to 'src/core/lib/backoff')
-rw-r--r--src/core/lib/backoff/backoff.cc16
-rw-r--r--src/core/lib/backoff/backoff.h12
2 files changed, 14 insertions, 14 deletions
diff --git a/src/core/lib/backoff/backoff.cc b/src/core/lib/backoff/backoff.cc
index 5dd91da4f3..dc754ddd82 100644
--- a/src/core/lib/backoff/backoff.cc
+++ b/src/core/lib/backoff/backoff.cc
@@ -20,7 +20,7 @@
#include <grpc/support/useful.h>
-void grpc_backoff_init(grpc_backoff *backoff, grpc_millis initial_backoff,
+void grpc_backoff_init(grpc_backoff* backoff, grpc_millis initial_backoff,
double multiplier, double jitter,
grpc_millis min_connect_timeout,
grpc_millis max_backoff) {
@@ -32,8 +32,8 @@ void grpc_backoff_init(grpc_backoff *backoff, grpc_millis initial_backoff,
backoff->rng_state = (uint32_t)gpr_now(GPR_CLOCK_REALTIME).tv_nsec;
}
-grpc_backoff_result grpc_backoff_begin(grpc_exec_ctx *exec_ctx,
- grpc_backoff *backoff) {
+grpc_backoff_result grpc_backoff_begin(grpc_exec_ctx* exec_ctx,
+ grpc_backoff* backoff) {
backoff->current_backoff = backoff->initial_backoff;
const grpc_millis initial_timeout =
GPR_MAX(backoff->initial_backoff, backoff->min_connect_timeout);
@@ -44,12 +44,12 @@ grpc_backoff_result grpc_backoff_begin(grpc_exec_ctx *exec_ctx,
}
/* Generate a random number between 0 and 1. */
-static double generate_uniform_random_number(uint32_t *rng_state) {
+static double generate_uniform_random_number(uint32_t* rng_state) {
*rng_state = (1103515245 * *rng_state + 12345) % ((uint32_t)1 << 31);
return *rng_state / (double)((uint32_t)1 << 31);
}
-static double generate_uniform_random_number_between(uint32_t *rng_state,
+static double generate_uniform_random_number_between(uint32_t* rng_state,
double a, double b) {
if (a == b) return a;
if (a > b) GPR_SWAP(double, a, b); // make sure a < b
@@ -57,8 +57,8 @@ static double generate_uniform_random_number_between(uint32_t *rng_state,
return a + generate_uniform_random_number(rng_state) * range;
}
-grpc_backoff_result grpc_backoff_step(grpc_exec_ctx *exec_ctx,
- grpc_backoff *backoff) {
+grpc_backoff_result grpc_backoff_step(grpc_exec_ctx* exec_ctx,
+ grpc_backoff* backoff) {
backoff->current_backoff = (grpc_millis)(GPR_MIN(
backoff->current_backoff * backoff->multiplier, backoff->max_backoff));
const double jitter = generate_uniform_random_number_between(
@@ -75,6 +75,6 @@ grpc_backoff_result grpc_backoff_step(grpc_exec_ctx *exec_ctx,
return result;
}
-void grpc_backoff_reset(grpc_backoff *backoff) {
+void grpc_backoff_reset(grpc_backoff* backoff) {
backoff->current_backoff = backoff->initial_backoff;
}
diff --git a/src/core/lib/backoff/backoff.h b/src/core/lib/backoff/backoff.h
index 8becf4aab8..1067281403 100644
--- a/src/core/lib/backoff/backoff.h
+++ b/src/core/lib/backoff/backoff.h
@@ -57,24 +57,24 @@ typedef struct {
} grpc_backoff_result;
/// Initialize backoff machinery - does not need to be destroyed
-void grpc_backoff_init(grpc_backoff *backoff, grpc_millis initial_backoff,
+void grpc_backoff_init(grpc_backoff* backoff, grpc_millis initial_backoff,
double multiplier, double jitter,
grpc_millis min_connect_timeout,
grpc_millis max_backoff);
/// Begin retry loop: returns the deadlines to be used for the current attempt
/// and the subsequent retry, if any.
-grpc_backoff_result grpc_backoff_begin(grpc_exec_ctx *exec_ctx,
- grpc_backoff *backoff);
+grpc_backoff_result grpc_backoff_begin(grpc_exec_ctx* exec_ctx,
+ grpc_backoff* backoff);
/// Step a retry loop: returns the deadlines to be used for the current attempt
/// and the subsequent retry, if any.
-grpc_backoff_result grpc_backoff_step(grpc_exec_ctx *exec_ctx,
- grpc_backoff *backoff);
+grpc_backoff_result grpc_backoff_step(grpc_exec_ctx* exec_ctx,
+ grpc_backoff* backoff);
/// Reset the backoff, so the next grpc_backoff_step will be a
/// grpc_backoff_begin.
-void grpc_backoff_reset(grpc_backoff *backoff);
+void grpc_backoff_reset(grpc_backoff* backoff);
#ifdef __cplusplus
}