From 1a2efa40eeeb140982e11932019dd165fe6fcdd5 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Fri, 30 Jun 2017 13:33:22 -0700 Subject: More progress on POSIX async connect stuff. Note that we're going to refactor this again, for both TCP and IPC, to actually push the endpoint abstraction further down instead of using a combined "socket" abstraction. This may help solve other problems, such as parallel outgoing connections. Nonetheless, most of the work to make POSIX sockets fully async is now done. --- src/platform/posix/posix_socket.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/platform/posix/posix_socket.c') diff --git a/src/platform/posix/posix_socket.c b/src/platform/posix/posix_socket.c index ce887a78..6d2b6c29 100644 --- a/src/platform/posix/posix_socket.c +++ b/src/platform/posix/posix_socket.c @@ -46,6 +46,7 @@ struct nni_posix_sock { int devnull; // for shutting down accept() char * unlink; // path to unlink at unbind nni_posix_pipedesc * pd; + nni_posix_epdesc * ed; int tcpnodelay; }; @@ -213,6 +214,9 @@ nni_posix_sock_fini(nni_posix_sock *s) if (s->pd != NULL) { nni_posix_pipedesc_fini(s->pd); } + if (s->ed != NULL) { + nni_posix_epdesc_fini(s->ed); + } if (s->unlink != NULL) { (void) unlink(s->unlink); nni_free(s->unlink, strlen(s->unlink) + 1); @@ -498,6 +502,11 @@ nni_posix_sock_connect_sync(nni_posix_sock *s, const nni_sockaddr *addr, (void) close(fd); return (rv); } + if (s->pd != NULL) { + // If we had a prior pipedesc hanging around, nuke it. + nni_posix_pipedesc_fini(s->pd); + s->pd = NULL; + } if ((rv = nni_posix_pipedesc_init(&s->pd, fd)) != 0) { (void) close(fd); return (rv); -- cgit v1.2.3-70-g09d2