From ba4c0662d0f0896ebc73d9259f64a38e58517075 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Wed, 28 Jun 2006 15:23:18 +0000 Subject: Fixed bug in ioqueue IOCP: accept() callback is called with new socket handle already reset to -1 git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@559 74dad513-b988-da41-8d7b-12977e46ad98 --- pjlib/src/pjlib-test/ioq_tcp.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'pjlib/src/pjlib-test/ioq_tcp.c') diff --git a/pjlib/src/pjlib-test/ioq_tcp.c b/pjlib/src/pjlib-test/ioq_tcp.c index 8f2d74d0..7f004d9f 100644 --- a/pjlib/src/pjlib-test/ioq_tcp.c +++ b/pjlib/src/pjlib-test/ioq_tcp.c @@ -82,11 +82,22 @@ static void on_ioqueue_accept(pj_ioqueue_key_t *key, pj_sock_t sock, int status) { - PJ_UNUSED_ARG(sock); - - callback_accept_key = key; - callback_accept_op = op_key; - callback_accept_status = status; + 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_op = op_key; + callback_accept_status = status; + } } static void on_ioqueue_connect(pj_ioqueue_key_t *key, int status) -- cgit v1.2.3