From 75aa863baa55b31d0230e8874d690567ffa9b1c2 Mon Sep 17 00:00:00 2001 From: Nanang Izzuddin Date: Wed, 4 Nov 2009 03:35:13 +0000 Subject: Misc fix (#951): Fixed possible random/unexpected pairs generated in ioqueue tcp unit test (such case was occured when test was performed using IOCP ioqueue on Vista). git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2983 74dad513-b988-da41-8d7b-12977e46ad98 --- pjlib/src/pjlib-test/ioq_tcp.c | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 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 ccafd443..64adb2f9 100644 --- a/pjlib/src/pjlib-test/ioq_tcp.c +++ b/pjlib/src/pjlib-test/ioq_tcp.c @@ -757,30 +757,28 @@ static int compliance_test_2(pj_bool_t allow_concur) ++pending_op; } - } - - - // Poll until all connected - while (pending_op) { - pj_time_val timeout = {1, 0}; + // Poll until connection of this pair established + while (pending_op) { + pj_time_val timeout = {1, 0}; #ifdef PJ_SYMBIAN - status = pj_symbianos_poll(-1, 1000); + status = pj_symbianos_poll(-1, 1000); #else - status = pj_ioqueue_poll(ioque, &timeout); + status = pj_ioqueue_poll(ioque, &timeout); #endif - if (status > 0) { - if (status > pending_op) { - PJ_LOG(3,(THIS_FILE, - "...error: pj_ioqueue_poll() returned %d " - "(only expecting %d)", - status, pending_op)); - return -110; - } - pending_op -= status; - - if (pending_op == 0) { - status = 0; + if (status > 0) { + if (status > pending_op) { + PJ_LOG(3,(THIS_FILE, + "...error: pj_ioqueue_poll() returned %d " + "(only expecting %d)", + status, pending_op)); + return -110; + } + pending_op -= status; + + if (pending_op == 0) { + status = 0; + } } } } -- cgit v1.2.3