From 2c4324c2b7a3dd5583b3b2c499575cf1c8e52e0c Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Thu, 26 Dec 2024 12:15:48 -0800 Subject: sockfd: convert to use nni_aio_start --- src/core/sockfd.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/core') 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. +// Copyright 2024 Staysail Systems, Inc. // // 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); -- cgit v1.2.3-70-g09d2