summaryrefslogtreecommitdiff
path: root/pjlib
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-07-06 20:43:07 +0000
committerBenny Prijono <bennylp@teluu.com>2006-07-06 20:43:07 +0000
commit4d30593203dace6434dd6524fea46d355708f62f (patch)
tree741bf7002a9db9819ace81ca1988715f6c4990cf /pjlib
parent163c395b2cfc15caf83ab2d46e79246c3909affd (diff)
Fixed link errors in ioqueue epoll backend
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@590 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib')
-rw-r--r--pjlib/src/pj/ioqueue_epoll.c15
-rw-r--r--pjlib/src/pjlib-test/ioq_udp.c8
-rw-r--r--pjlib/src/pjlib-test/test.h12
3 files changed, 25 insertions, 10 deletions
diff --git a/pjlib/src/pj/ioqueue_epoll.c b/pjlib/src/pj/ioqueue_epoll.c
index f732c67f..14a6cc32 100644
--- a/pjlib/src/pj/ioqueue_epoll.c
+++ b/pjlib/src/pj/ioqueue_epoll.c
@@ -141,8 +141,8 @@
#define THIS_FILE "ioq_epoll"
-//#define TRACE_(expr) PJ_LOG(3,expr)
-#define TRACE_(expr)
+#define TRACE_(expr) PJ_LOG(3,expr)
+//#define TRACE_(expr)
/*
* Include common ioqueue abstraction.
@@ -297,12 +297,20 @@ PJ_DEF(pj_status_t) pj_ioqueue_register_sock( pj_pool_t *pool,
goto on_return;
}
+ /* Create key's mutex */
+ rc = pj_mutex_create_recursive(pool, NULL, &key->mutex);
+ if (rc != PJ_SUCCESS) {
+ key = NULL;
+ goto on_return;
+ }
+
/* os_epoll_ctl. */
ev.events = EPOLLIN | EPOLLOUT | EPOLLERR;
ev.epoll_data = (epoll_data_type)key;
status = os_epoll_ctl(ioqueue->epfd, EPOLL_CTL_ADD, sock, &ev);
if (status < 0) {
rc = pj_get_os_error();
+ pj_mutex_destroy(key->mutex);
key = NULL;
TRACE_((THIS_FILE,
"pj_ioqueue_register_sock error: os_epoll_ctl rc=%d",
@@ -353,7 +361,8 @@ PJ_DEF(pj_status_t) pj_ioqueue_unregister( pj_ioqueue_key_t *key)
pj_lock_release(ioqueue->lock);
/* Destroy the key. */
- ioqueue_destroy_key(key);
+ pj_sock_close(key->fd);
+ pj_mutex_destroy(key->mutex);
return PJ_SUCCESS;
}
diff --git a/pjlib/src/pjlib-test/ioq_udp.c b/pjlib/src/pjlib-test/ioq_udp.c
index 31d013b4..d26e8fd9 100644
--- a/pjlib/src/pjlib-test/ioq_udp.c
+++ b/pjlib/src/pjlib-test/ioq_udp.c
@@ -817,6 +817,8 @@ int udp_ioqueue_test()
int status;
int bufsize, sock_count;
+ goto pass1;
+
PJ_LOG(3, (THIS_FILE, "...compliance test (%s)", pj_ioqueue_name()));
if ((status=compliance_test()) != 0) {
return status;
@@ -838,22 +840,26 @@ int udp_ioqueue_test()
PJ_LOG(4, (THIS_FILE, "... note: buf=bytes sent, fds=# of fds, "
"elapsed=in timer ticks"));
+pass1:
PJ_LOG(3, (THIS_FILE, "...Benchmarking poll times for %s:", pj_ioqueue_name()));
PJ_LOG(3, (THIS_FILE, "...====================================="));
PJ_LOG(3, (THIS_FILE, "...Buf.size #inactive-socks Time/poll"));
PJ_LOG(3, (THIS_FILE, "... (bytes) (nanosec)"));
PJ_LOG(3, (THIS_FILE, "...====================================="));
+ goto pass2;
+
for (bufsize=BUF_MIN_SIZE; bufsize <= BUF_MAX_SIZE; bufsize *= 2) {
if ((status=bench_test(bufsize, SOCK_INACTIVE_MIN)) != 0)
return status;
}
+pass2:
bufsize = 512;
for (sock_count=SOCK_INACTIVE_MIN+2;
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 52600866..b7fd6ded 100644
--- a/pjlib/src/pjlib-test/test.h
+++ b/pjlib/src/pjlib-test/test.h
@@ -21,11 +21,11 @@
#include <pj/types.h>
-#define GROUP_LIBC 1
-#define GROUP_OS 1
-#define GROUP_DATA_STRUCTURE 1
-#define GROUP_NETWORK 1
-#define GROUP_FILE 1
+#define GROUP_LIBC 0
+#define GROUP_OS 0
+#define GROUP_DATA_STRUCTURE 0
+#define GROUP_NETWORK 0
+#define GROUP_FILE 0
#define INCLUDE_ERRNO_TEST GROUP_LIBC
#define INCLUDE_TIMESTAMP_TEST GROUP_OS
@@ -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 GROUP_NETWORK
+#define INCLUDE_UDP_IOQUEUE_TEST 1 //GROUP_NETWORK
#define INCLUDE_TCP_IOQUEUE_TEST GROUP_NETWORK
#define INCLUDE_IOQUEUE_PERF_TEST GROUP_NETWORK
#define INCLUDE_IOQUEUE_UNREG_TEST GROUP_NETWORK