diff options
author | Nanang Izzuddin <nanang@teluu.com> | 2009-11-04 03:35:13 +0000 |
---|---|---|
committer | Nanang Izzuddin <nanang@teluu.com> | 2009-11-04 03:35:13 +0000 |
commit | 75aa863baa55b31d0230e8874d690567ffa9b1c2 (patch) | |
tree | 614b1c77c4b4c64e5ed7931e1f40dbba22ed8956 | |
parent | 8b0fc9fe689b7ca2fce23b2ee1dd6c91d0585d2b (diff) |
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
-rw-r--r-- | pjlib/src/pjlib-test/ioq_tcp.c | 38 |
1 files changed, 18 insertions, 20 deletions
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; + } } } } |