[asterisk-commits] rizzo: branch rizzo/astobj2 r47793 - in
/team/rizzo/astobj2: channels/ includ...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Fri Nov 17 07:30:44 MST 2006
Author: rizzo
Date: Fri Nov 17 08:30:43 2006
New Revision: 47793
URL: http://svn.digium.com/view/asterisk?view=rev&rev=47793
Log:
debug 'dialog' destruction.
Modified:
team/rizzo/astobj2/channels/chan_sip.c
team/rizzo/astobj2/include/asterisk/astobj2.h
team/rizzo/astobj2/main/astobj2.c
Modified: team/rizzo/astobj2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_sip.c?view=diff&rev=47793&r1=47792&r2=47793
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Fri Nov 17 08:30:43 2006
@@ -3041,7 +3041,7 @@
transmit_invite(p, SIP_INVITE, 1, 2);
/* Initialize auto-congest time */
- p->initid = ast_sched_add(sched, SIP_TRANS_TIMEOUT, auto_congest, p); /* XXX pvt_ref ? */
+ p->initid = ast_sched_add(sched, SIP_TRANS_TIMEOUT, auto_congest, pvt_ref(p));
}
return res;
}
@@ -3119,10 +3119,16 @@
if (p->stateid > -1)
ast_extension_state_del(p->stateid, NULL);
- if (p->initid > -1)
+ if (p->initid > -1) {
+ ast_verbose("XXX very strange, pvt_destructor has initid != 0 %p\n", p);
ast_sched_del(sched, p->initid);
- if (p->autokillid > -1)
+ pvt_unref(p);
+ }
+ if (p->autokillid > -1) {
+ ast_verbose("XXX very strange, pvt_destructor has autokillid != 0 %p\n", p);
ast_sched_del(sched, p->autokillid);
+ pvt_unref(p);
+ }
if (p->rtp)
ast_rtp_destroy(p->rtp);
@@ -3181,8 +3187,17 @@
static struct sip_pvt *__sip_destroy(struct sip_pvt *p)
{
+#ifdef USE_AO2
+ /* debugging */
+ int n = ao2_ref(p, 0);
+ if (n != 1) {
+ ast_verbose("__sip_destroy on object with %d refs\n", n);
+ ao2_bt();
+ *(char *)0 = 1;/* crash */
+ }
pvt_unref(p); /* automatically calls pvt_destructor on ao2*/
-#ifndef USE_AO2
+#else
+ pvt_unref(p); /* automatically calls pvt_destructor on ao2*/
ast_mutex_destroy(&p->pvt_lock); /* XXX not used in ao2 */
pvt_destructor(p);
free(p);
@@ -12018,6 +12033,7 @@
/* Don't auto congest anymore since we've gotten something useful back */
ast_sched_del(sched, p->initid);
p->initid = -1;
+ pvt_unref(p);
}
/* RFC3261 says we must treat every 1xx response (but not 100)
@@ -12363,8 +12379,8 @@
ast_sched_del(sched, r->timeout);
}
r->timeout=-1;
- if (r->register_pvt) /* XXX are we sure about destroy ? */
- r->register_pvt = sip_destroy(r->register_pvt);
+ if (r->register_pvt) /* XXX are we sure about pvt_unref ? */
+ r->register_pvt = pvt_unref(r->register_pvt);
p->registry = NULL;
/* Let this one hang around until we have all the responses */
sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
Modified: team/rizzo/astobj2/include/asterisk/astobj2.h
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/include/asterisk/astobj2.h?view=diff&rev=47793&r1=47792&r2=47793
==============================================================================
--- team/rizzo/astobj2/include/asterisk/astobj2.h (original)
+++ team/rizzo/astobj2/include/asterisk/astobj2.h Fri Nov 17 08:30:43 2006
@@ -144,6 +144,7 @@
*/
typedef void (*ao2_destructor_fn)(void *);
+void ao2_bt(void); /* backtrace */
/*!
* Allocate and initialize an object.
*
Modified: team/rizzo/astobj2/main/astobj2.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/main/astobj2.c?view=diff&rev=47793&r1=47792&r2=47793
==============================================================================
--- team/rizzo/astobj2/main/astobj2.c (original)
+++ team/rizzo/astobj2/main/astobj2.c Fri Nov 17 08:30:43 2006
@@ -66,11 +66,11 @@
static struct ao2_stats ao2;
#ifndef HAVE_BKTR /* backtrace support */
-static void bt(void) {}
+void ao2_bt(void) {}
#else
#include <execinfo.h> /* for backtrace */
-static void bt(void) {
+void ao2_bt(void) {
int c, i;
#define N1 20
void *addresses[N1];
@@ -95,7 +95,7 @@
struct astobj2 *p;\
\
if (user_data == NULL) {\
- bt();\
+ ao2_bt();\
assert(user_data != NULL);\
}\
p = (struct astobj2 *)((char *)(user_data) - sizeof(struct astobj2));\
More information about the asterisk-commits
mailing list