diff options
author | Benny Prijono <bennylp@teluu.com> | 2006-07-08 19:46:43 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2006-07-08 19:46:43 +0000 |
commit | a286f67546eb45c9779660decfb990b38203a268 (patch) | |
tree | c1332dc8c7179d59960eef3d68422aefe83cb8ab /pjlib/src/pjlib-test | |
parent | fc263fb7b06d10cabe2dabeb6a22a722a463527b (diff) |
Attempted to fix epoll for Linux
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@592 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/src/pjlib-test')
-rw-r--r-- | pjlib/src/pjlib-test/ioq_tcp.c | 27 | ||||
-rw-r--r-- | pjlib/src/pjlib-test/ioq_udp.c | 10 | ||||
-rw-r--r-- | pjlib/src/pjlib-test/test.h | 4 |
3 files changed, 20 insertions, 21 deletions
diff --git a/pjlib/src/pjlib-test/ioq_tcp.c b/pjlib/src/pjlib-test/ioq_tcp.c index 7f004d9f..4a546f03 100644 --- a/pjlib/src/pjlib-test/ioq_tcp.c +++ b/pjlib/src/pjlib-test/ioq_tcp.c @@ -38,7 +38,6 @@ #if PJ_HAS_TCP #define THIS_FILE "test_tcp" -#define PORT 50000 #define NON_EXISTANT_PORT 50123 #define LOOP 100 #define BUF_MIN_SIZE 32 @@ -257,14 +256,21 @@ static int compliance_test_0(void) } // Bind server socket. - memset(&addr, 0, sizeof(addr)); - addr.sin_family = PJ_AF_INET; - addr.sin_port = pj_htons(PORT); - if (pj_sock_bind(ssock, &addr, sizeof(addr))) { + pj_sockaddr_in_init(&addr, 0, 0); + if ((rc=pj_sock_bind(ssock, &addr, sizeof(addr))) != 0 ) { app_perror("...bind error", rc); status=-10; goto on_error; } + // Get server address. + client_addr_len = sizeof(addr); + rc = pj_sock_getsockname(ssock, &addr, &client_addr_len); + if (rc != PJ_SUCCESS) { + app_perror("...ERROR in pj_sock_getsockname()", rc); + status=-15; goto on_error; + } + addr.sin_addr = pj_inet_addr(pj_cstr(&s, "127.0.0.1")); + // Create I/O Queue. rc = pj_ioqueue_create(pool, PJ_IOQUEUE_MAX_HANDLES, &ioque); if (rc != PJ_SUCCESS) { @@ -302,12 +308,6 @@ static int compliance_test_0(void) ++pending_op; } - // Initialize remote address. - memset(&addr, 0, sizeof(addr)); - addr.sin_family = PJ_AF_INET; - addr.sin_port = pj_htons(PORT); - addr.sin_addr = pj_inet_addr(pj_cstr(&s, "127.0.0.1")); - // Client socket connect() status = pj_ioqueue_connect(ckey1, &addr, sizeof(addr)); if (status!=PJ_SUCCESS && status != PJ_EPENDING) { @@ -461,10 +461,7 @@ static int compliance_test_1(void) } // Initialize remote address. - memset(&addr, 0, sizeof(addr)); - addr.sin_family = PJ_AF_INET; - addr.sin_port = pj_htons(NON_EXISTANT_PORT); - addr.sin_addr = pj_inet_addr(pj_cstr(&s, "127.0.0.1")); + pj_sockaddr_in_init(&addr, pj_cstr(&s, "127.0.0.1"), NON_EXISTANT_PORT); // Client socket connect() status = pj_ioqueue_connect(ckey1, &addr, sizeof(addr)); diff --git a/pjlib/src/pjlib-test/ioq_udp.c b/pjlib/src/pjlib-test/ioq_udp.c index d26e8fd9..dfc818fb 100644 --- a/pjlib/src/pjlib-test/ioq_udp.c +++ b/pjlib/src/pjlib-test/ioq_udp.c @@ -40,7 +40,7 @@ #define THIS_FILE "test_udp" #define PORT 51233 -#define LOOP 100 +#define LOOP 2 ///#define LOOP 2 #define BUF_MIN_SIZE 32 #define BUF_MAX_SIZE 2048 @@ -817,7 +817,7 @@ int udp_ioqueue_test() int status; int bufsize, sock_count; - goto pass1; + //goto pass1; PJ_LOG(3, (THIS_FILE, "...compliance test (%s)", pj_ioqueue_name())); if ((status=compliance_test()) != 0) { @@ -836,6 +836,8 @@ int udp_ioqueue_test() return status; } + //return 0; + PJ_LOG(4, (THIS_FILE, "...benchmarking different buffer size:")); PJ_LOG(4, (THIS_FILE, "... note: buf=bytes sent, fds=# of fds, " "elapsed=in timer ticks")); @@ -847,7 +849,7 @@ pass1: PJ_LOG(3, (THIS_FILE, "... (bytes) (nanosec)")); PJ_LOG(3, (THIS_FILE, "...=====================================")); - goto pass2; + //goto pass2; for (bufsize=BUF_MIN_SIZE; bufsize <= BUF_MAX_SIZE; bufsize *= 2) { if ((status=bench_test(bufsize, SOCK_INACTIVE_MIN)) != 0) @@ -859,7 +861,7 @@ pass2: sock_count<=SOCK_INACTIVE_MAX+2; sock_count *= 2) { - PJ_LOG(3,(THIS_FILE, "...testing with %d fds", sock_count)); + //PJ_LOG(3,(THIS_FILE, "...testing with %d fds", sock_count)); if ((status=bench_test(bufsize, sock_count-2)) != 0) return status; } diff --git a/pjlib/src/pjlib-test/test.h b/pjlib/src/pjlib-test/test.h index b7fd6ded..d552ea40 100644 --- a/pjlib/src/pjlib-test/test.h +++ b/pjlib/src/pjlib-test/test.h @@ -24,7 +24,7 @@ #define GROUP_LIBC 0 #define GROUP_OS 0 #define GROUP_DATA_STRUCTURE 0 -#define GROUP_NETWORK 0 +#define GROUP_NETWORK 1 #define GROUP_FILE 0 #define INCLUDE_ERRNO_TEST GROUP_LIBC @@ -45,7 +45,7 @@ #define INCLUDE_SOCK_TEST GROUP_NETWORK #define INCLUDE_SOCK_PERF_TEST GROUP_NETWORK #define INCLUDE_SELECT_TEST GROUP_NETWORK -#define INCLUDE_UDP_IOQUEUE_TEST 1 //GROUP_NETWORK +#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 GROUP_NETWORK |