From 58b633f4c091118278ca9e485a56b3ee24ba7a11 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Thu, 15 Oct 2009 04:04:45 +0000 Subject: Fixed ticket #973: pj_ioqueue_accept() fails on Windows NT IOCP backend if connection is immediately available and the "local" parameter is NULL (thanks John Ridges for the report) git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2947 74dad513-b988-da41-8d7b-12977e46ad98 --- pjlib/src/pj/ioqueue_winnt.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'pjlib') diff --git a/pjlib/src/pj/ioqueue_winnt.c b/pjlib/src/pj/ioqueue_winnt.c index f12e8eec..254d6530 100644 --- a/pjlib/src/pj/ioqueue_winnt.c +++ b/pjlib/src/pj/ioqueue_winnt.c @@ -1208,14 +1208,16 @@ PJ_DEF(pj_status_t) pj_ioqueue_accept( pj_ioqueue_key_t *key, sock = WSAAccept((SOCKET)key->hnd, remote, addrlen, NULL, 0); if (sock != INVALID_SOCKET) { /* Yes! New socket is available! */ - int status; + if (local && addrlen) { + int status; - status = getsockname(sock, local, addrlen); - if (status != 0) { - DWORD dwError = WSAGetLastError(); - closesocket(sock); - return PJ_RETURN_OS_ERROR(dwError); - } + status = getsockname(sock, local, addrlen); + if (status != 0) { + DWORD dwError = WSAGetLastError(); + closesocket(sock); + return PJ_RETURN_OS_ERROR(dwError); + } + } *new_sock = sock; return PJ_SUCCESS; -- cgit v1.2.3