diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-12-26 12:15:48 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-12-26 12:53:46 -0800 |
| commit | 2c4324c2b7a3dd5583b3b2c499575cf1c8e52e0c (patch) | |
| tree | 6c6a70bcc3d2f2d78981dcf662b178e0a2da7277 /src/core | |
| parent | b5826dac78e75520c26f2d84a952fe04d69fa2d3 (diff) | |
| download | nng-2c4324c2b7a3dd5583b3b2c499575cf1c8e52e0c.tar.gz nng-2c4324c2b7a3dd5583b3b2c499575cf1c8e52e0c.tar.bz2 nng-2c4324c2b7a3dd5583b3b2c499575cf1c8e52e0c.zip | |
sockfd: convert to use nni_aio_start
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/sockfd.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/core/sockfd.c b/src/core/sockfd.c index 1a0e792f..ce0c6772 100644 --- a/src/core/sockfd.c +++ b/src/core/sockfd.c @@ -1,5 +1,5 @@ // -// Copyright 2023 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech> // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -116,10 +116,11 @@ sfd_listener_accept(void *arg, nng_aio *aio) { sfd_listener *l = arg; - if (nni_aio_begin(aio) != 0) { + nni_mtx_lock(&l->mtx); + if (!nni_aio_start(aio, sfd_cancel_accept, l)) { + nni_mtx_unlock(&l->mtx); return; } - nni_mtx_lock(&l->mtx); if (l->closed) { nni_mtx_unlock(&l->mtx); nni_aio_finish_error(aio, NNG_ECLOSED); @@ -128,7 +129,7 @@ sfd_listener_accept(void *arg, nng_aio *aio) if (l->listen_cnt) { sfd_start_conn(l, aio); - } else if (nni_aio_defer(aio, sfd_cancel_accept, l)) { + } else { nni_aio_list_append(&l->accept_q, aio); } nni_mtx_unlock(&l->mtx); |
