summaryrefslogtreecommitdiff
path: root/src/core/socket.c
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-11-08 08:25:44 -0800
commit768eaa4d50a6a436b714188ec9c6b98fd729b306 (patch)
tree62a8ea7ae2b9359ade5d320f89aa0b92580f8cab /src/core/socket.c
parent4cf963ee46c91c666d43cf5f3a9783e32c8906d2 (diff)
downloadnng-768eaa4d50a6a436b714188ec9c6b98fd729b306.tar.gz
nng-768eaa4d50a6a436b714188ec9c6b98fd729b306.tar.bz2
nng-768eaa4d50a6a436b714188ec9c6b98fd729b306.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. (cherry picked from commit 2dfb99506142f2d59bcc0e0fa7db6b19a3c75d43)
Diffstat (limited to 'src/core/socket.c')
-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