mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-13 12:40:17 +00:00
Wed Sep 3 13:55:22 EDT 2008 Pekka Pessi <first.last@nokia.com>
* nua: using HAVE_MEMLEAK_LOG Logging nua_handle_ref() and nua_handle_unref(). git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9420 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
fc0293d266
commit
a2740a96c8
@ -1 +1 @@
|
|||||||
Wed Sep 3 14:27:37 EDT 2008
|
Wed Sep 3 14:29:03 EDT 2008
|
||||||
|
@ -163,8 +163,47 @@ static void nh_destructor(void *arg)
|
|||||||
SU_DEBUG_0(("nh_destructor(%p)\n", (void *)nh));
|
SU_DEBUG_0(("nh_destructor(%p)\n", (void *)nh));
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef nua_handle_ref
|
#if HAVE_MEMLEAK_LOG
|
||||||
#undef nua_handle_unref
|
|
||||||
|
nua_handle_t *
|
||||||
|
_nua_handle_ref_by(nua_handle_t *nh,
|
||||||
|
char const *file, unsigned line,
|
||||||
|
char const *function)
|
||||||
|
{
|
||||||
|
if (nh)
|
||||||
|
SU_DEBUG_0(("%p - nua_handle_ref() => "MOD_ZU" by %s:%u: %s()\n",
|
||||||
|
nh, su_home_refcount((su_home_t *)nh) + 1, file, line, by));
|
||||||
|
return (nua_handle_t *)su_home_ref((su_home_t *)nh);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
_nua_handle_unref_by(nua_handle_t *nh,
|
||||||
|
char const *file, unsigned line,
|
||||||
|
char const *function)
|
||||||
|
{
|
||||||
|
if (nh) {
|
||||||
|
size_t refcount = su_home_refcount((su_home_t *)nh) - 1;
|
||||||
|
int freed = su_home_unref((su_home_t *)nh);
|
||||||
|
if (freed) refcount = 0;
|
||||||
|
SU_DEBUG_0(("%p - nua_handle_unref() => "MOD_ZU" by %s:%u: %s()\n",
|
||||||
|
nh, refcount, file, line, by));
|
||||||
|
return freed;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
nua_handle_t *nua_handle_ref(nua_handle_t *nh)
|
||||||
|
{
|
||||||
|
return _nua_handle_ref_by(nh, "<app>", 0, "<app>")
|
||||||
|
}
|
||||||
|
|
||||||
|
int nua_handle_unref(nua_handle_t *nh)
|
||||||
|
{
|
||||||
|
return _nua_handle_unref_by(nh, "<app>", 0, "<app>")
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
/** Make a new reference to handle.
|
/** Make a new reference to handle.
|
||||||
*
|
*
|
||||||
@ -198,6 +237,8 @@ int nua_handle_unref(nua_handle_t *nh)
|
|||||||
return su_home_unref(nh->nh_home);
|
return su_home_unref(nh->nh_home);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Generate an instance identifier. */
|
/** Generate an instance identifier. */
|
||||||
char const *nua_generate_instance_identifier(su_home_t *home)
|
char const *nua_generate_instance_identifier(su_home_t *home)
|
||||||
{
|
{
|
||||||
|
@ -103,37 +103,6 @@ typedef struct register_usage nua_registration_t;
|
|||||||
TAG_IF((include) && (soa) && soa_is_remote_chat_active(soa) >= 0, \
|
TAG_IF((include) && (soa) && soa_is_remote_chat_active(soa) >= 0, \
|
||||||
SOATAG_ACTIVE_CHAT(soa_is_remote_chat_active(soa)))
|
SOATAG_ACTIVE_CHAT(soa_is_remote_chat_active(soa)))
|
||||||
|
|
||||||
#if HAVE_NUA_HANDLE_DEBUG
|
|
||||||
|
|
||||||
#define nua_handle_ref(nh) nua_handle_ref_by((nh), __func__)
|
|
||||||
#define nua_handle_unref(nh) nua_handle_unref_by((nh), __func__)
|
|
||||||
|
|
||||||
su_inline nua_handle_t *nua_handle_ref_by(nua_handle_t *nh,
|
|
||||||
char const *by)
|
|
||||||
{
|
|
||||||
if (nh)
|
|
||||||
SU_DEBUG_0(("nua_handle_ref(%p) => "MOD_ZU" by %s\n", nh,
|
|
||||||
su_home_refcount((su_home_t *)nh) + 1,
|
|
||||||
by));
|
|
||||||
return (nua_handle_t *)su_home_ref((su_home_t *)nh);
|
|
||||||
}
|
|
||||||
|
|
||||||
su_inline int nua_handle_unref_by(nua_handle_t *nh, char const *by)
|
|
||||||
{
|
|
||||||
if (nh) {
|
|
||||||
size_t refcount = su_home_refcount((su_home_t *)nh) - 1;
|
|
||||||
int freed = su_home_unref((su_home_t *)nh);
|
|
||||||
if (freed) refcount = 0;
|
|
||||||
SU_DEBUG_0(("nua_handle_unref(%p) => "MOD_ZU" by %s\n",
|
|
||||||
nh, refcount, by));
|
|
||||||
return freed;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** @internal @brief NUA handle.
|
/** @internal @brief NUA handle.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -277,6 +246,20 @@ struct nua_s {
|
|||||||
#define __func__ "nua"
|
#define __func__ "nua"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_MEMLEAK_LOG
|
||||||
|
|
||||||
|
#define nua_handle_ref(nh) \
|
||||||
|
_nua_handle_ref_by((nh), __FILE__, __LINE__, __func__)
|
||||||
|
#define nua_handle_unref(nh) \
|
||||||
|
_nua_handle_unref_by((nh), __FILE__, __LINE__, __func__)
|
||||||
|
|
||||||
|
nua_handle_t *_nua_handle_ref_by(
|
||||||
|
nua_handle_t *nh, char const *file, unsigned line, char const *by);
|
||||||
|
int _nua_handle_unref_by(
|
||||||
|
nua_handle_t *nh, char const *file, unsigned line, char const *by);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
su_inline nua_t *nua_stack_ref(nua_t *nua)
|
su_inline nua_t *nua_stack_ref(nua_t *nua)
|
||||||
{
|
{
|
||||||
return (nua_t *)su_home_ref(nua->nua_home);
|
return (nua_t *)su_home_ref(nua->nua_home);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user