diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-06-30 13:33:22 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-06-30 13:33:22 -0700 |
| commit | 1a2efa40eeeb140982e11932019dd165fe6fcdd5 (patch) | |
| tree | 1d4f88099f2c3baae08cc4ddcba5b12fc28e8b06 /src/platform/posix/posix_socket.c | |
| parent | 69c309ec479900f9389aacba18d8c1d3026ece46 (diff) | |
| download | nng-1a2efa40eeeb140982e11932019dd165fe6fcdd5.tar.gz nng-1a2efa40eeeb140982e11932019dd165fe6fcdd5.tar.bz2 nng-1a2efa40eeeb140982e11932019dd165fe6fcdd5.zip | |
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.
Diffstat (limited to 'src/platform/posix/posix_socket.c')
| -rw-r--r-- | src/platform/posix/posix_socket.c | 9 |
1 files changed, 9 insertions, 0 deletions
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); |
