From c5b07415cc3a6a7960cb3ca2a2aaf70b1cbe3469 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 27 Apr 2025 19:07:03 -0700 Subject: AIO: Use nng_err for cancellation callback instead of int. This is part of our work to improve type safety/awareness, and also improve debugger support, for NNG error codes. There are still quite a few more but this should help. --- src/core/aio.c | 2 +- src/core/aio.h | 2 +- src/core/aio_test.c | 2 +- src/core/device.c | 4 ++-- src/core/msgqueue.c | 2 +- src/core/sockfd.c | 2 +- src/core/tcp.c | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/core') diff --git a/src/core/aio.c b/src/core/aio.c index 9b0fe4d5..4c4c78b6 100644 --- a/src/core/aio.c +++ b/src/core/aio.c @@ -762,7 +762,7 @@ nni_aio_iov_advance(nni_aio *aio, size_t n) } static void -nni_sleep_cancel(nng_aio *aio, void *arg, int rv) +nni_sleep_cancel(nng_aio *aio, void *arg, nng_err rv) { NNI_ARG_UNUSED(arg); nni_aio_expire_q *eq = aio->a_expire_q; diff --git a/src/core/aio.h b/src/core/aio.h index a1b06e1d..5884e253 100644 --- a/src/core/aio.h +++ b/src/core/aio.h @@ -17,7 +17,7 @@ #include "core/taskq.h" #include "core/thread.h" -typedef void (*nni_aio_cancel_fn)(nni_aio *, void *, int); +typedef void (*nni_aio_cancel_fn)(nni_aio *, void *, nng_err); // nni_aio_init initializes an aio object. The callback is called with // the supplied argument when the operation is complete. If NULL is diff --git a/src/core/aio_test.c b/src/core/aio_test.c index 01765dce..99060349 100644 --- a/src/core/aio_test.c +++ b/src/core/aio_test.c @@ -25,7 +25,7 @@ sleep_done(void *arg) } static void -cancel(nng_aio *aio, void *arg, int rv) +cancel(nng_aio *aio, void *arg, nng_err rv) { *(int *) arg = rv; nng_aio_finish(aio, rv); diff --git a/src/core/device.c b/src/core/device.c index 24ba5499..68ab2f38 100644 --- a/src/core/device.c +++ b/src/core/device.c @@ -1,5 +1,5 @@ // -// Copyright 2024 Staysail Systems, Inc. +// Copyright 2025 Staysail Systems, Inc. // Copyright 2018 Capitar IT Group BV // // This software is supplied under the terms of the MIT License, a @@ -60,7 +60,7 @@ device_fini(void *arg) } static void -device_cancel(nni_aio *aio, void *arg, int rv) +device_cancel(nni_aio *aio, void *arg, nng_err rv) { device_data *d = arg; // cancellation is the only path to shutting it down. diff --git a/src/core/msgqueue.c b/src/core/msgqueue.c index f0f2de8b..5d33fd94 100644 --- a/src/core/msgqueue.c +++ b/src/core/msgqueue.c @@ -197,7 +197,7 @@ nni_msgq_run_notify(nni_msgq *mq) } static void -nni_msgq_cancel(nni_aio *aio, void *arg, int rv) +nni_msgq_cancel(nni_aio *aio, void *arg, nng_err rv) { nni_msgq *mq = arg; diff --git a/src/core/sockfd.c b/src/core/sockfd.c index ce0c6772..758cb755 100644 --- a/src/core/sockfd.c +++ b/src/core/sockfd.c @@ -99,7 +99,7 @@ sfd_start_conn(sfd_listener *l, nni_aio *aio) } static void -sfd_cancel_accept(nni_aio *aio, void *arg, int rv) +sfd_cancel_accept(nni_aio *aio, void *arg, nng_err rv) { sfd_listener *l = arg; diff --git a/src/core/tcp.c b/src/core/tcp.c index b0ed75fb..f7a30ed2 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -35,7 +35,7 @@ typedef struct { } tcp_dialer; static void -tcp_dial_cancel(nni_aio *aio, void *arg, int rv) +tcp_dial_cancel(nni_aio *aio, void *arg, nng_err rv) { tcp_dialer *d = arg; -- cgit v1.2.3-70-g09d2