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:
parent
a14fe1f936
commit
01de33bed9
3 changed files with 17 additions and 6 deletions
|
@ -184,7 +184,6 @@ static void ioqueue_on_accept_complete(ioqueue_accept_rec *accept_overlapped)
|
||||||
if (accept_overlapped->newsock_ptr)
|
if (accept_overlapped->newsock_ptr)
|
||||||
*accept_overlapped->newsock_ptr = accept_overlapped->newsock;
|
*accept_overlapped->newsock_ptr = accept_overlapped->newsock;
|
||||||
accept_overlapped->operation = 0;
|
accept_overlapped->operation = 0;
|
||||||
accept_overlapped->newsock = PJ_INVALID_SOCKET;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void erase_connecting_socket( pj_ioqueue_t *ioqueue, unsigned pos)
|
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,
|
(pj_ioqueue_op_key_t*)pOv,
|
||||||
accept_rec->newsock,
|
accept_rec->newsock,
|
||||||
PJ_SUCCESS);
|
PJ_SUCCESS);
|
||||||
|
accept_rec->newsock = PJ_INVALID_SOCKET;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PJ_IOQUEUE_OP_CONNECT:
|
case PJ_IOQUEUE_OP_CONNECT:
|
||||||
|
|
|
@ -82,11 +82,22 @@ static void on_ioqueue_accept(pj_ioqueue_key_t *key,
|
||||||
pj_sock_t sock,
|
pj_sock_t sock,
|
||||||
int status)
|
int status)
|
||||||
{
|
{
|
||||||
PJ_UNUSED_ARG(sock);
|
if (sock == PJ_INVALID_SOCKET) {
|
||||||
|
|
||||||
|
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_key = key;
|
||||||
callback_accept_op = op_key;
|
callback_accept_op = op_key;
|
||||||
callback_accept_status = status;
|
callback_accept_status = status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_ioqueue_connect(pj_ioqueue_key_t *key, int status)
|
static void on_ioqueue_connect(pj_ioqueue_key_t *key, int status)
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
#define INCLUDE_UDP_IOQUEUE_TEST GROUP_NETWORK
|
#define INCLUDE_UDP_IOQUEUE_TEST GROUP_NETWORK
|
||||||
#define INCLUDE_TCP_IOQUEUE_TEST GROUP_NETWORK
|
#define INCLUDE_TCP_IOQUEUE_TEST GROUP_NETWORK
|
||||||
#define INCLUDE_IOQUEUE_PERF_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_FILE_TEST GROUP_FILE
|
||||||
|
|
||||||
#define INCLUDE_ECHO_SERVER 0
|
#define INCLUDE_ECHO_SERVER 0
|
||||||
|
|
Loading…
Reference in a new issue