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
diff --git a/pjlib/src/pjlib-test/ioq_tcp.c b/pjlib/src/pjlib-test/ioq_tcp.c
index 8f2d74d..7f004d9 100644
--- a/pjlib/src/pjlib-test/ioq_tcp.c
+++ b/pjlib/src/pjlib-test/ioq_tcp.c
@@ -82,11 +82,22 @@
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)
diff --git a/pjlib/src/pjlib-test/test.h b/pjlib/src/pjlib-test/test.h
index 53400e2..5260086 100644
--- a/pjlib/src/pjlib-test/test.h
+++ b/pjlib/src/pjlib-test/test.h
@@ -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