summaryrefslogtreecommitdiff
path: root/src/platform/posix/posix_net.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-03-29 17:05:08 -0700
committerGarrett D'Amore <garrett@damore.org>2017-03-29 17:05:08 -0700
commit86eaf052cc535658783dd5c3d5925f58fd70f983 (patch)
treee7675f617b749a5a4c5aeb8ca00e0b9be6f84e2a /src/platform/posix/posix_net.c
parent84990c6ecb35ef322b74b8cc9e74ad5964b66ee5 (diff)
downloadnng-86eaf052cc535658783dd5c3d5925f58fd70f983.tar.gz
nng-86eaf052cc535658783dd5c3d5925f58fd70f983.tar.bz2
nng-86eaf052cc535658783dd5c3d5925f58fd70f983.zip
IPC send/recv works asynchronously for POSIX.
As with TCP, we're still using threads under the hood. But this completes the send/recv logic conversion for POSIX to our AIO framework, and hence represents a substantial milestone towards full asyncronous operation. We still need to do accept/connect operations asynchronously, then making. Windows overlapped IO work properly. After that, poll/epoll/kqueue, etc.
Diffstat (limited to 'src/platform/posix/posix_net.c')
-rw-r--r--src/platform/posix/posix_net.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/platform/posix/posix_net.c b/src/platform/posix/posix_net.c
index c7651655..94dc2667 100644
--- a/src/platform/posix/posix_net.c
+++ b/src/platform/posix/posix_net.c
@@ -8,9 +8,9 @@
//
#include "core/nng_impl.h"
-#include "platform/posix/posix_aio.h"
#ifdef PLATFORM_POSIX_NET
+#include "platform/posix/posix_aio.h"
#include <errno.h>
#include <stdlib.h>
@@ -31,13 +31,11 @@
#define NNI_TCP_SOCKTYPE SOCK_STREAM
#endif
-#ifdef PLATFORM_POSIX_NET
struct nni_plat_tcpsock {
int fd;
- int devnull; // used for shutting down blocking accept()
+ int devnull; // for shutting down accept()
nni_posix_aio_pipe aiop;
};
-#endif
static int
nni_plat_to_sockaddr(struct sockaddr_storage *ss, const nni_sockaddr *sa)
@@ -284,6 +282,7 @@ nni_plat_tcp_fini(nni_plat_tcpsock *tsp)
(void) close(tsp->fd);
tsp->fd = -1;
}
+ nni_posix_aio_pipe_fini(&tsp->aiop);
NNI_FREE_STRUCT(tsp);
}