Changeset 1789 for pjproject/trunk/pjlib/src/pjlib-test/ioq_udp.c
- Timestamp:
- Feb 13, 2008 3:17:28 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pjlib-test/ioq_udp.c
r1405 r1789 126 126 * data between two sockets. 127 127 */ 128 static int compliance_test( void)128 static int compliance_test(pj_bool_t allow_concur) 129 129 { 130 130 pj_sock_t ssock=-1, csock=-1; … … 177 177 if (rc != PJ_SUCCESS) { 178 178 status=-20; goto on_error; 179 } 180 181 // Set concurrency 182 TRACE_("set concurrency..."); 183 rc = pj_ioqueue_set_default_concurrency(ioque, allow_concur); 184 if (rc != PJ_SUCCESS) { 185 status=-21; goto on_error; 179 186 } 180 187 … … 352 359 * closed. 353 360 */ 354 static int unregister_test( void)361 static int unregister_test(pj_bool_t allow_concur) 355 362 { 356 363 enum { RPORT = 50000, SPORT = 50001 }; … … 382 389 } 383 390 391 // Set concurrency 392 TRACE_("set concurrency..."); 393 status = pj_ioqueue_set_default_concurrency(ioqueue, allow_concur); 394 if (status != PJ_SUCCESS) { 395 return -112; 396 } 397 384 398 /* Create sender socket */ 385 399 status = app_socket(pj_AF_INET(), pj_SOCK_DGRAM(), 0, SPORT, &ssock); … … 513 527 * of sockets to the ioqueue. 514 528 */ 515 static int many_handles_test( void)529 static int many_handles_test(pj_bool_t allow_concur) 516 530 { 517 531 enum { MAX = PJ_IOQUEUE_MAX_HANDLES }; … … 538 552 app_perror("...error in pj_ioqueue_create", rc); 539 553 return -10; 554 } 555 556 // Set concurrency 557 rc = pj_ioqueue_set_default_concurrency(ioqueue, allow_concur); 558 if (rc != PJ_SUCCESS) { 559 return -11; 540 560 } 541 561 … … 601 621 * Benchmarking IOQueue 602 622 */ 603 static int bench_test(int bufsize, int inactive_sock_count) 623 static int bench_test(pj_bool_t allow_concur, int bufsize, 624 int inactive_sock_count) 604 625 { 605 626 pj_sock_t ssock=-1, csock=-1; … … 649 670 if (rc != PJ_SUCCESS) { 650 671 app_perror("...error: pj_ioqueue_create()", rc); 672 goto on_error; 673 } 674 675 // Set concurrency 676 rc = pj_ioqueue_set_default_concurrency(ioque, allow_concur); 677 if (rc != PJ_SUCCESS) { 678 app_perror("...error: pj_ioqueue_set_default_concurrency()", rc); 651 679 goto on_error; 652 680 } … … 840 868 } 841 869 842 int udp_ioqueue_test()870 static int udp_ioqueue_test_imp(pj_bool_t allow_concur) 843 871 { 844 872 int status; 845 873 int bufsize, sock_count; 846 874 875 PJ_LOG(3,(THIS_FILE, "..testing with concurency=%d", allow_concur)); 876 847 877 //goto pass1; 848 878 849 879 PJ_LOG(3, (THIS_FILE, "...compliance test (%s)", pj_ioqueue_name())); 850 if ((status=compliance_test( )) != 0) {880 if ((status=compliance_test(allow_concur)) != 0) { 851 881 return status; 852 882 } … … 855 885 856 886 PJ_LOG(3, (THIS_FILE, "...unregister test (%s)", pj_ioqueue_name())); 857 if ((status=unregister_test( )) != 0) {887 if ((status=unregister_test(allow_concur)) != 0) { 858 888 return status; 859 889 } 860 890 PJ_LOG(3, (THIS_FILE, "....unregister test ok")); 861 891 862 if ((status=many_handles_test( )) != 0) {892 if ((status=many_handles_test(allow_concur)) != 0) { 863 893 return status; 864 894 } … … 880 910 881 911 for (bufsize=BUF_MIN_SIZE; bufsize <= BUF_MAX_SIZE; bufsize *= 2) { 882 if ((status=bench_test( bufsize, SOCK_INACTIVE_MIN)) != 0)912 if ((status=bench_test(allow_concur, bufsize, SOCK_INACTIVE_MIN)) != 0) 883 913 return status; 884 914 } … … 890 920 { 891 921 //PJ_LOG(3,(THIS_FILE, "...testing with %d fds", sock_count)); 892 if ((status=bench_test( bufsize, sock_count-2)) != 0)922 if ((status=bench_test(allow_concur, bufsize, sock_count-2)) != 0) 893 923 return status; 894 924 } 925 return 0; 926 } 927 928 int udp_ioqueue_test() 929 { 930 int rc; 931 932 rc = udp_ioqueue_test_imp(PJ_TRUE); 933 if (rc != 0) 934 return rc; 935 936 rc = udp_ioqueue_test_imp(PJ_FALSE); 937 if (rc != 0) 938 return rc; 939 895 940 return 0; 896 941 }
Note: See TracChangeset
for help on using the changeset viewer.