From 3a723632181efa25234977609d178564c3d5f09b Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 6 Oct 2024 22:59:29 -0700 Subject: [PATCH 1/4] Bump codecov to v4 --- .github/workflows/coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 977df6a02..189221137 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -24,7 +24,7 @@ jobs: run: cd build && ctest --output-on-failure - name: Upload report - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} yml: ./.codecov.yml From 2dfb99506142f2d59bcc0e0fa7db6b19a3c75d43 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 7 Oct 2024 00:13:02 -0700 Subject: [PATCH 2/4] 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. --- src/core/socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/socket.c b/src/core/socket.c index e501a2da2..c4e16f709 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 From 8a71020fbdad464f902138d5c07e886251d900ca Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 7 Oct 2024 00:14:23 -0700 Subject: [PATCH 3/4] Fix case for infinite sleep. If one tries to sleep indefinitely, a sign bug leads to constantly waking calls, which causes an infinite cycle in the expire loop. --- src/core/aio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/aio.c b/src/core/aio.c index 27ec6d9c9..1c7e41d16 100644 --- a/src/core/aio.c +++ b/src/core/aio.c @@ -755,12 +755,13 @@ nni_sleep_aio(nng_duration ms, nng_aio *aio) default: // If the timeout on the aio is shorter than our sleep time, // then let it still wake up early, but with NNG_ETIMEDOUT. - if (ms > aio->a_timeout) { + if ((ms == NNG_DURATION_INFINITE) || (ms > aio->a_timeout)) { aio->a_expire_ok = false; ms = aio->a_timeout; } } - aio->a_expire = nni_clock() + ms; + aio->a_expire = + ms == NNG_DURATION_INFINITE ? NNI_TIME_NEVER : nni_clock() + ms; if ((rv = nni_aio_schedule(aio, nni_sleep_cancel, NULL)) != 0) { nni_aio_finish_error(aio, rv); From ad68e788892f4db08f2dbbee6ef393ea6ef0b895 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 7 Oct 2024 00:16:00 -0700 Subject: [PATCH 4/4] Finally, actually register the UDP transport. --- src/sp/transport.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/sp/transport.c b/src/sp/transport.c index 1d895c828..973be40b0 100644 --- a/src/sp/transport.c +++ b/src/sp/transport.c @@ -63,6 +63,9 @@ extern void nni_sp_tcp_register(void); #ifdef NNG_TRANSPORT_TLS extern void nni_sp_tls_register(void); #endif +#ifdef NNG_TRANSPORT_UDP +extern void nni_sp_udp_register(void); +#endif #ifdef NNG_TRANSPORT_WS extern void nni_sp_ws_register(void); #endif @@ -91,6 +94,9 @@ nni_sp_tran_sys_init(void) #ifdef NNG_TRANSPORT_TLS nni_sp_tls_register(); #endif +#ifdef NNG_TRANSPORT_UDP + nni_sp_udp_register(); +#endif #ifdef NNG_TRANSPORT_WS nni_sp_ws_register(); #endif