summaryrefslogtreecommitdiff
path: root/pjsip/src
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-07-03 14:18:17 +0000
committerBenny Prijono <bennylp@teluu.com>2006-07-03 14:18:17 +0000
commit63147d55f091ec8ba1a5b57cb04b421938ec9fde (patch)
tree472a6675304f57a815f6f0380ab631373be766a6 /pjsip/src
parent589260d10d6915e1f55724099508fc742012b838 (diff)
Fixed minor bug in pool_caching.c that prevent pool from being reused if the capacity has changed when the pool is released
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@581 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src')
-rw-r--r--pjsip/src/pjsip/sip_endpoint.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/pjsip/src/pjsip/sip_endpoint.c b/pjsip/src/pjsip/sip_endpoint.c
index ba8967a9..940fdf16 100644
--- a/pjsip/src/pjsip/sip_endpoint.c
+++ b/pjsip/src/pjsip/sip_endpoint.c
@@ -88,6 +88,15 @@ struct pjsip_endpoint
};
+#if defined(PJSIP_SAFE_MODULE) && PJSIP_SAFE_MODULE!=0
+# define LOCK_MODULE_ACCESS(ept) pj_rwmutex_lock_read(ept->mod_mutex)
+# define UNLOCK_MODULE_ACCESS(ept) pj_rwmutex_unlock_read(ept->mod_mutex)
+#else
+# define LOCK_MODULE_ACCESS(endpt)
+# define UNLOCK_MODULE_ACCESS(endpt)
+#endif
+
+
/*
* Prototypes.
@@ -581,9 +590,14 @@ PJ_DEF(void) pjsip_endpt_release_pool( pjsip_endpoint *endpt, pj_pool_t *pool )
{
PJ_LOG(6, (THIS_FILE, "Releasing pool %s", pj_pool_getobjname(pool)));
- pj_mutex_lock(endpt->mutex);
+ /* Don't need to acquire mutex since pool factory is thread safe
+ pj_mutex_lock(endpt->mutex);
+ */
pj_pool_release( pool );
+
+ /*
pj_mutex_unlock(endpt->mutex);
+ */
}
@@ -776,7 +790,7 @@ static void endpt_on_rx_msg( pjsip_endpoint *endpt,
/* Distribute to modules, starting from modules with highest priority */
- pj_rwmutex_lock_read(endpt->mod_mutex);
+ LOCK_MODULE_ACCESS(endpt);
if (msg->type == PJSIP_REQUEST_MSG) {
pjsip_module *mod;
@@ -823,7 +837,7 @@ static void endpt_on_rx_msg( pjsip_endpoint *endpt,
}
}
- pj_rwmutex_unlock_read(endpt->mod_mutex);
+ UNLOCK_MODULE_ACCESS(endpt);
/* Must clear mod_data before returning rdata to transport, since
* rdata may be reused.
@@ -842,7 +856,7 @@ static pj_status_t endpt_on_tx_msg( pjsip_endpoint *endpt,
pjsip_module *mod;
/* Distribute to modules, starting from modules with LOWEST priority */
- pj_rwmutex_lock_read(endpt->mod_mutex);
+ LOCK_MODULE_ACCESS(endpt);
mod = endpt->module_list.prev;
if (tdata->msg->type == PJSIP_REQUEST_MSG) {
@@ -864,7 +878,7 @@ static pj_status_t endpt_on_tx_msg( pjsip_endpoint *endpt,
}
}
- pj_rwmutex_unlock_read(endpt->mod_mutex);
+ UNLOCK_MODULE_ACCESS(endpt);
return status;
}