Fixed bug in ioqueue IOCP: accept() callback is called with new socket handle already reset to -1

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@559 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
Benny Prijono 2006-06-28 15:23:18 +00:00
parent a14fe1f936
commit 01de33bed9
3 changed files with 17 additions and 6 deletions

View File

@ -184,7 +184,6 @@ static void ioqueue_on_accept_complete(ioqueue_accept_rec *accept_overlapped)
if (accept_overlapped->newsock_ptr)
*accept_overlapped->newsock_ptr = accept_overlapped->newsock;
accept_overlapped->operation = 0;
accept_overlapped->newsock = PJ_INVALID_SOCKET;
}
static void erase_connecting_socket( pj_ioqueue_t *ioqueue, unsigned pos)
@ -632,6 +631,7 @@ static pj_bool_t poll_iocp( HANDLE hIocp, DWORD dwTimeout,
(pj_ioqueue_op_key_t*)pOv,
accept_rec->newsock,
PJ_SUCCESS);
accept_rec->newsock = PJ_INVALID_SOCKET;
}
break;
case PJ_IOQUEUE_OP_CONNECT:

View File

@ -82,11 +82,22 @@ static void on_ioqueue_accept(pj_ioqueue_key_t *key,
pj_sock_t sock,
int status)
{
PJ_UNUSED_ARG(sock);
if (sock == PJ_INVALID_SOCKET) {
callback_accept_key = key;
callback_accept_op = op_key;
callback_accept_status = status;
if (status != PJ_SUCCESS) {
/* Ignore. Could be blocking error */
app_perror(".....warning: received error in on_ioqueue_accept() callback",
status);
} else {
callback_accept_status = -61;
PJ_LOG(3,("", "..... on_ioqueue_accept() callback was given "
"invalid socket and status is %d", status));
}
} else {
callback_accept_key = key;
callback_accept_op = op_key;
callback_accept_status = status;
}
}
static void on_ioqueue_connect(pj_ioqueue_key_t *key, int status)

View File

@ -48,7 +48,7 @@
#define INCLUDE_UDP_IOQUEUE_TEST GROUP_NETWORK
#define INCLUDE_TCP_IOQUEUE_TEST GROUP_NETWORK
#define INCLUDE_IOQUEUE_PERF_TEST GROUP_NETWORK
#define INCLUDE_IOQUEUE_UNREG_TEST 1 // GROUP_NETWORK
#define INCLUDE_IOQUEUE_UNREG_TEST GROUP_NETWORK
#define INCLUDE_FILE_TEST GROUP_FILE
#define INCLUDE_ECHO_SERVER 0