aboutsummaryrefslogtreecommitdiff
path: root/src/core/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/socket.c')
-rw-r--r--src/core/socket.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/core/socket.c b/src/core/socket.c
index bffe0f67..6e3f14d0 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -1375,26 +1375,28 @@ nni_ctx_setopt(
static void
dialer_timer_start_locked(nni_dialer *d)
{
- nni_duration backoff;
+ nni_duration back_off;
nni_sock * sock = d->d_sock;
if (d->d_closing || sock->s_closed) {
return;
}
- backoff = d->d_currtime;
- d->d_currtime *= 2;
- if ((d->d_maxrtime > 0) && (d->d_currtime > d->d_maxrtime)) {
- d->d_currtime = d->d_maxrtime;
+ back_off = d->d_currtime;
+ if (d->d_maxrtime > 0) {
+ d->d_currtime *= 2;
+ if (d->d_currtime > d->d_maxrtime) {
+ d->d_currtime = d->d_maxrtime;
+ }
}
- // To minimize damage from storms, etc., we select a backoff
- // value randomly, in the range of [0, backoff-1]; this is
- // pretty similar to 802 style backoff, except that we have a
+ // To minimize damage from storms, etc., we select a back-off
+ // value randomly, in the range of [0, back_off-1]; this is
+ // pretty similar to 802 style back-off, except that we have a
// nearly uniform time period instead of discrete slot times.
// This algorithm may lead to slight biases because we don't
// have a statistically perfect distribution with the modulo of
// the random number, but this really doesn't matter.
- nni_sleep_aio(backoff ? nni_random() % backoff : 0, d->d_tmo_aio);
+ nni_sleep_aio(back_off ? nni_random() % back_off : 0, d->d_tmo_aio);
}
void