aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2024-10-07 00:13:02 -0700
committerGarrett D'Amore <garrett@damore.org>2024-10-07 00:13:02 -0700
commit2dfb99506142f2d59bcc0e0fa7db6b19a3c75d43 (patch)
treee0a42094897d956ae098eb133304481173616f50
parent3a723632181efa25234977609d178564c3d5f09b (diff)
downloadnng-2dfb99506142f2d59bcc0e0fa7db6b19a3c75d43.tar.gz
nng-2dfb99506142f2d59bcc0e0fa7db6b19a3c75d43.tar.bz2
nng-2dfb99506142f2d59bcc0e0fa7db6b19a3c75d43.zip
Integer sign extension bug in socket.c.
It turns out that for now this results in early wakeups, due to another bug in the aio framework. But when that bug is fixed, this bug will lead to hangs when redialing.
-rw-r--r--src/core/socket.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/socket.c b/src/core/socket.c
index e501a2da..c4e16f70 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -1485,8 +1485,8 @@ dialer_timer_start_locked(nni_dialer *d)
// 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(
- back_off ? (int) nni_random() % back_off : 0, &d->d_tmo_aio);
+ nni_sleep_aio(back_off ? (nng_duration) (nni_random() % back_off) : 0,
+ &d->d_tmo_aio);
}
void