summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pjlib/include/pj/config_site_sample.h8
-rw-r--r--pjlib/src/pj/ioqueue_common_abs.c18
-rw-r--r--pjlib/src/pj/ioqueue_select.c6
-rw-r--r--pjlib/src/pj/os_core_unix.c8
4 files changed, 23 insertions, 17 deletions
diff --git a/pjlib/include/pj/config_site_sample.h b/pjlib/include/pj/config_site_sample.h
index 3b9b55d9..dfbdb2d7 100644
--- a/pjlib/include/pj/config_site_sample.h
+++ b/pjlib/include/pj/config_site_sample.h
@@ -44,16 +44,16 @@
# define PJ_ENABLE_EXTRA_CHECK 0
# define PJ_HAS_ERROR_STRING 0
# undef PJ_IOQUEUE_MAX_HANDLES
-# define PJ_IOQUEUE_MAX_HANDLES 4
-# define PJSIP_MAX_TSX_COUNT 16
-# define PJSIP_MAX_DIALOG_COUNT 16
+# define PJ_IOQUEUE_MAX_HANDLES 16
+# define PJSIP_MAX_TSX_COUNT 15
+# define PJSIP_MAX_DIALOG_COUNT 15
# define PJSIP_UDP_SO_SNDBUF_SIZE 4000
# define PJSIP_UDP_SO_RCVBUF_SIZE 4000
# define PJSIP_AUTH_HEADER_CACHING 0
# define PJSIP_AUTH_AUTO_SEND_NEXT 0
# define PJSIP_AUTH_QOP_SUPPORT 0
# define PJMEDIA_HAS_LARGE_FILTER 0
-# define PJMEDIA_HAS_SMALL_FILTER 1
+# define PJMEDIA_HAS_SMALL_FILTER 0
#elif defined(PJ_CONFIG_MAXIMUM_SPEED)
diff --git a/pjlib/src/pj/ioqueue_common_abs.c b/pjlib/src/pj/ioqueue_common_abs.c
index be562fa7..97868fb7 100644
--- a/pjlib/src/pj/ioqueue_common_abs.c
+++ b/pjlib/src/pj/ioqueue_common_abs.c
@@ -183,7 +183,7 @@ void ioqueue_dispatch_write_event(pj_ioqueue_t *ioqueue, pj_ioqueue_key_t *h)
/* Lock the key. */
pj_mutex_lock(h->mutex);
- if (h->closing) {
+ if (IS_CLOSING(h)) {
pj_mutex_unlock(h->mutex);
return;
}
@@ -361,7 +361,7 @@ void ioqueue_dispatch_read_event( pj_ioqueue_t *ioqueue, pj_ioqueue_key_t *h )
/* Lock the key. */
pj_mutex_lock(h->mutex);
- if (h->closing) {
+ if (IS_CLOSING(h)) {
pj_mutex_unlock(h->mutex);
return;
}
@@ -510,7 +510,7 @@ void ioqueue_dispatch_exception_event( pj_ioqueue_t *ioqueue,
return;
}
- if (h->closing) {
+ if (IS_CLOSING(h)) {
pj_mutex_unlock(h->mutex);
return;
}
@@ -560,7 +560,7 @@ PJ_DEF(pj_status_t) pj_ioqueue_recv( pj_ioqueue_key_t *key,
read_op->op = 0;
/* Check if key is closing. */
- if (key->closing)
+ if (IS_CLOSING(key))
return PJ_ECANCELLED;
/* Try to see if there's data immediately available.
@@ -622,7 +622,7 @@ PJ_DEF(pj_status_t) pj_ioqueue_recvfrom( pj_ioqueue_key_t *key,
PJ_CHECK_STACK();
/* Check if key is closing. */
- if (key->closing)
+ if (IS_CLOSING(key))
return PJ_ECANCELLED;
read_op = (struct read_operation*)op_key;
@@ -691,7 +691,7 @@ PJ_DEF(pj_status_t) pj_ioqueue_send( pj_ioqueue_key_t *key,
PJ_CHECK_STACK();
/* Check if key is closing. */
- if (key->closing)
+ if (IS_CLOSING(key))
return PJ_ECANCELLED;
/* We can not use PJ_IOQUEUE_ALWAYS_ASYNC for socket write. */
@@ -800,7 +800,7 @@ PJ_DEF(pj_status_t) pj_ioqueue_sendto( pj_ioqueue_key_t *key,
PJ_CHECK_STACK();
/* Check if key is closing. */
- if (key->closing)
+ if (IS_CLOSING(key))
return PJ_ECANCELLED;
/* We can not use PJ_IOQUEUE_ALWAYS_ASYNC for socket write */
@@ -913,7 +913,7 @@ PJ_DEF(pj_status_t) pj_ioqueue_accept( pj_ioqueue_key_t *key,
PJ_ASSERT_RETURN(key && op_key && new_sock, PJ_EINVAL);
/* Check if key is closing. */
- if (key->closing)
+ if (IS_CLOSING(key))
return PJ_ECANCELLED;
accept_op = (struct accept_operation*)op_key;
@@ -978,7 +978,7 @@ PJ_DEF(pj_status_t) pj_ioqueue_connect( pj_ioqueue_key_t *key,
PJ_ASSERT_RETURN(key && addr && addrlen, PJ_EINVAL);
/* Check if key is closing. */
- if (key->closing)
+ if (IS_CLOSING(key))
return PJ_ECANCELLED;
/* Check if socket has not been marked for connecting */
diff --git a/pjlib/src/pj/ioqueue_select.c b/pjlib/src/pj/ioqueue_select.c
index 93adf07d..2cdb3eb2 100644
--- a/pjlib/src/pj/ioqueue_select.c
+++ b/pjlib/src/pj/ioqueue_select.c
@@ -696,7 +696,7 @@ PJ_DEF(int) pj_ioqueue_poll( pj_ioqueue_t *ioqueue, const pj_time_val *timeout)
for ( ; h!=&ioqueue->active_list && counter<count; h = h->next) {
if ( (key_has_pending_write(h) || key_has_pending_connect(h))
- && PJ_FD_ISSET(h->fd, &wfdset) && !h->closing)
+ && PJ_FD_ISSET(h->fd, &wfdset) && !IS_CLOSING(h))
{
#if PJ_IOQUEUE_HAS_SAFE_UNREG
increment_counter(h);
@@ -708,7 +708,7 @@ PJ_DEF(int) pj_ioqueue_poll( pj_ioqueue_t *ioqueue, const pj_time_val *timeout)
/* Scan for readable socket. */
if ((key_has_pending_read(h) || key_has_pending_accept(h))
- && PJ_FD_ISSET(h->fd, &rfdset) && !h->closing)
+ && PJ_FD_ISSET(h->fd, &rfdset) && !IS_CLOSING(h))
{
#if PJ_IOQUEUE_HAS_SAFE_UNREG
increment_counter(h);
@@ -720,7 +720,7 @@ PJ_DEF(int) pj_ioqueue_poll( pj_ioqueue_t *ioqueue, const pj_time_val *timeout)
#if PJ_HAS_TCP
if (key_has_pending_connect(h) && PJ_FD_ISSET(h->fd, &xfdset) &&
- !h->closing)
+ !IS_CLOSING(h))
{
#if PJ_IOQUEUE_HAS_SAFE_UNREG
increment_counter(h);
diff --git a/pjlib/src/pj/os_core_unix.c b/pjlib/src/pj/os_core_unix.c
index c7ea2594..a65c8e89 100644
--- a/pjlib/src/pj/os_core_unix.c
+++ b/pjlib/src/pj/os_core_unix.c
@@ -184,7 +184,12 @@ PJ_DEF(pj_uint32_t) pj_getpid(void)
*/
PJ_DEF(pj_bool_t) pj_thread_is_registered(void)
{
+#if PJ_HAS_THREADS
return pj_thread_local_get(thread_tls_id) != 0;
+#else
+ pj_assert("pj_thread_is_registered() called in non-threading mode!");
+ return PJ_TRUE;
+#endif
}
@@ -944,7 +949,8 @@ PJ_DEF(pj_status_t) pj_mutex_create(pj_pool_t *pool,
*ptr_mutex = mutex;
return PJ_SUCCESS;
#else /* PJ_HAS_THREADS */
- return (pj_mutex_t*)1;
+ *ptr_mutex = (pj_mutex_t*)1;
+ return PJ_SUCCESS;
#endif
}