summaryrefslogtreecommitdiff
path: root/pjlib
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2009-10-15 04:04:45 +0000
committerBenny Prijono <bennylp@teluu.com>2009-10-15 04:04:45 +0000
commit58b633f4c091118278ca9e485a56b3ee24ba7a11 (patch)
tree3a721dcfc4b0c2be250227cd071f74ff4b711b9e /pjlib
parent02dba30b6c6c5b420d25f629024736ebbca0755f (diff)
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
Diffstat (limited to 'pjlib')
-rw-r--r--pjlib/src/pj/ioqueue_winnt.c16
1 files changed, 9 insertions, 7 deletions
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;