diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-07-04 10:00:19 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-07-04 10:00:19 -0700 |
| commit | f39b983f7acbb13c6818ff67b214fdf89597b73d (patch) | |
| tree | 174f1d780c8b3a55459dfd027d7613b522ac2469 /src/platform | |
| parent | a80654e3e0abb7ddbd81a6159dd89933bdec44e7 (diff) | |
| download | nng-f39b983f7acbb13c6818ff67b214fdf89597b73d.tar.gz nng-f39b983f7acbb13c6818ff67b214fdf89597b73d.tar.bz2 nng-f39b983f7acbb13c6818ff67b214fdf89597b73d.zip | |
Rename aio functions. Enhanced epdesc_finish.
Diffstat (limited to 'src/platform')
| -rw-r--r-- | src/platform/posix/posix_ipc.c | 4 | ||||
| -rw-r--r-- | src/platform/posix/posix_poll.c | 22 |
2 files changed, 15 insertions, 11 deletions
diff --git a/src/platform/posix/posix_ipc.c b/src/platform/posix/posix_ipc.c index a3d95428..c1911a05 100644 --- a/src/platform/posix/posix_ipc.c +++ b/src/platform/posix/posix_ipc.c @@ -54,14 +54,14 @@ nni_plat_ipc_path_resolve(nni_sockaddr *addr, const char *path) void -nni_plat_ipc_aio_send(nni_plat_ipcsock *s, nni_aio *aio) +nni_plat_ipc_send(nni_plat_ipcsock *s, nni_aio *aio) { nni_posix_sock_aio_send((void *) s, aio); } void -nni_plat_ipc_aio_recv(nni_plat_ipcsock *s, nni_aio *aio) +nni_plat_ipc_recv(nni_plat_ipcsock *s, nni_aio *aio) { nni_posix_sock_aio_recv((void *) s, aio); } diff --git a/src/platform/posix/posix_poll.c b/src/platform/posix/posix_poll.c index e5a2dadf..97868ff7 100644 --- a/src/platform/posix/posix_poll.c +++ b/src/platform/posix/posix_poll.c @@ -140,14 +140,25 @@ static void nni_posix_epdesc_finish(nni_aio *aio, int rv, int newfd) { nni_posix_epdesc *ed; + nni_posix_pipedesc *pd; ed = aio->a_prov_data; + + // acceptq or connectq. if (nni_list_active(&ed->connectq, aio)) { nni_list_remove(&ed->connectq, aio); } + if (rv == 0) { + rv = nni_posix_pipedesc_init(&pd, newfd); + if (rv != 0) { + (void) close(newfd); + } else { + aio->a_pipe = pipe; + } + } // Abuse the count to hold our new fd. This is only for accept. - nni_aio_finish(aio, rv, newfd); + nni_aio_finish(aio, rv, 0); } @@ -173,7 +184,7 @@ nni_posix_poll_connect(nni_posix_epdesc *ed) switch (rv) { case 0: // Success! - nni_posix_epdesc_finish(aio, 0, 0); + nni_posix_epdesc_finish(aio, 0, ed->fd); continue; case EINPROGRESS: @@ -213,7 +224,6 @@ nni_posix_poll_accept(nni_posix_epdesc *ed) if (newfd >= 0) { // successful connection request! - // We abuse the count to hold our new file descriptor. nni_posix_epdesc_finish(aio, 0, newfd); continue; } @@ -924,9 +934,6 @@ nni_posix_pipedesc_sysfini(void) } -// extern int nni_posix_aio_ep_init(nni_posix_aio_ep *, int); -// extern void nni_posix_aio_ep_fini(nni_posix_aio_ep *); - void nni_posix_pipedesc_recv(nni_posix_pipedesc *pd, nni_aio *aio) { @@ -941,9 +948,6 @@ nni_posix_pipedesc_send(nni_posix_pipedesc *pd, nni_aio *aio) } -// extern int nni_posix_aio_connect(); -// extern int nni_posix_aio_accept(); - #else // Suppress empty symbols warnings in ranlib. |
