diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-10-03 20:28:09 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-10-05 21:25:57 -0700 |
| commit | b0f31f578b0669b598d3ded3a625685b125bef1d (patch) | |
| tree | 0044b1f6924700a4fe4e557826bb79796f9e94d0 /src/platform/posix/posix_sockaddr.c | |
| parent | 557964482f2b9d4246a2943fb1bedc6074d01e0d (diff) | |
| download | nng-b0f31f578b0669b598d3ded3a625685b125bef1d.tar.gz nng-b0f31f578b0669b598d3ded3a625685b125bef1d.tar.bz2 nng-b0f31f578b0669b598d3ded3a625685b125bef1d.zip | |
Improve UDP test coverage, fix numerous issues found.
We introduced richer, deeper tests for UDP functionality.
These tests uncovered a number of issues which this commit fixes.
The Windows IOCP code needs to support multiple aios on a single
nni_win_event. A redesign of the IOCP handling addresses that.
The POSIX UDP code also needed fixes; foremost among them is the
fact that the UDP file descriptor is not placed into non-blocking
mode, leading to potential hangs.
A number of race conditions and bugs along the implementation of
the above items were uncovered and fixed. To the best of our knowledge
the current code is bug-free.
Diffstat (limited to 'src/platform/posix/posix_sockaddr.c')
| -rw-r--r-- | src/platform/posix/posix_sockaddr.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/platform/posix/posix_sockaddr.c b/src/platform/posix/posix_sockaddr.c index ea630b01..25953f50 100644 --- a/src/platform/posix/posix_sockaddr.c +++ b/src/platform/posix/posix_sockaddr.c @@ -33,6 +33,9 @@ nni_posix_nn2sockaddr(void *sa, const nni_sockaddr *na) const nng_sockaddr_path *nspath; size_t sz; + if ((sa == NULL) || (na == NULL)) { + return (-1); + } switch (na->s_un.s_family) { case NNG_AF_INET: sin = (void *) sa; @@ -80,6 +83,9 @@ nni_posix_sockaddr2nn(nni_sockaddr *na, const void *sa) nng_sockaddr_in6 * nsin6; nng_sockaddr_path * nspath; + if ((na == NULL) || (sa == NULL)) { + return (-1); + } switch (((struct sockaddr *) sa)->sa_family) { case AF_INET: sin = (void *) sa; |
