From b0f31f578b0669b598d3ded3a625685b125bef1d Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Tue, 3 Oct 2017 20:28:09 -0700 Subject: 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. --- src/platform/windows/win_sockaddr.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/platform/windows/win_sockaddr.c') diff --git a/src/platform/windows/win_sockaddr.c b/src/platform/windows/win_sockaddr.c index 0fa6dd51..f66542c6 100644 --- a/src/platform/windows/win_sockaddr.c +++ b/src/platform/windows/win_sockaddr.c @@ -20,6 +20,9 @@ nni_win_nn2sockaddr(SOCKADDR_STORAGE *ss, const nni_sockaddr *sa) SOCKADDR_IN * sin; SOCKADDR_IN6 *sin6; + if ((ss == NULL) || (sa == NULL)) { + return (-1); + } switch (sa->s_un.s_family) { case NNG_AF_INET: sin = (void *) ss; @@ -46,6 +49,9 @@ nni_win_sockaddr2nn(nni_sockaddr *sa, const SOCKADDR_STORAGE *ss) SOCKADDR_IN * sin; SOCKADDR_IN6 *sin6; + if ((ss == NULL) || (sa == NULL)) { + return (-1); + } switch (ss->ss_family) { case PF_INET: sin = (void *) ss; -- cgit v1.2.3-70-g09d2