aboutsummaryrefslogtreecommitdiff
path: root/src/platform/posix/posix_ipcconn.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-07-31 12:33:58 -0700
committerGarrett D'Amore <garrett@damore.org>2018-08-05 18:45:04 +0300
commitd7f7c896c0ede24249ef63b1e45b1878bf4bd473 (patch)
tree32eece7d91a648f24cb174096fb9667cab978f37 /src/platform/posix/posix_ipcconn.c
parentccc24a8e508131a2226474642a038baaa2cbcc8c (diff)
downloadnng-d7f7c896c0ede24249ef63b1e45b1878bf4bd473.tar.gz
nng-d7f7c896c0ede24249ef63b1e45b1878bf4bd473.tar.bz2
nng-d7f7c896c0ede24249ef63b1e45b1878bf4bd473.zip
fixes #599 nng_dial sync should not return until added to socket
fixes #208 pipe start should occur before connect / accept fixes #616 Race condition closing between header & body This refactors the transports to handle their own connection handshaking before passing the pipe to the socket. This changes and simplifies the setup. This also fixes a rather challenging race condition described by #616.
Diffstat (limited to 'src/platform/posix/posix_ipcconn.c')
-rw-r--r--src/platform/posix/posix_ipcconn.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/platform/posix/posix_ipcconn.c b/src/platform/posix/posix_ipcconn.c
index 2b46fb12..539a00ba 100644
--- a/src/platform/posix/posix_ipcconn.c
+++ b/src/platform/posix/posix_ipcconn.c
@@ -47,6 +47,10 @@ ipc_conn_dowrite(nni_ipc_conn *c)
int fd;
if (c->closed || ((fd = nni_posix_pfd_fd(c->pfd)) < 0)) {
+ while ((aio = nni_list_first(&c->writeq)) != NULL) {
+ nni_aio_list_remove(aio);
+ nni_aio_finish_error(aio, NNG_ECLOSED);
+ }
return;
}
@@ -129,6 +133,10 @@ ipc_conn_doread(nni_ipc_conn *c)
int fd;
if (c->closed || ((fd = nni_posix_pfd_fd(c->pfd)) < 0)) {
+ while ((aio = nni_list_first(&c->readq)) != NULL) {
+ nni_aio_list_remove(aio);
+ nni_aio_finish_error(aio, NNG_ECLOSED);
+ }
return;
}