[asterisk-commits] murf: branch murf/bug11210 r99121 - /team/murf/bug11210/channels/chan_iax2.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jan 18 16:33:21 CST 2008
Author: murf
Date: Fri Jan 18 16:33:21 2008
New Revision: 99121
URL: http://svn.digium.com/view/asterisk?view=rev&rev=99121
Log:
OK, these changes should raise some warnings if we try to insert into a table, and have trouble
Modified:
team/murf/bug11210/channels/chan_iax2.c
Change Statistics:
team/murf/bug11210/channels/chan_iax2.c | 30 +++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
Modified: team/murf/bug11210/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/channels/chan_iax2.c?view=diff&rev=99121&r1=99120&r2=99121
==============================================================================
--- team/murf/bug11210/channels/chan_iax2.c (original)
+++ team/murf/bug11210/channels/chan_iax2.c Fri Jan 18 16:33:21 2008
@@ -1631,8 +1631,12 @@
iaxs[x]->callno = x;
iaxs[callno] = NULL;
/* put it back in in the new spot */
+#define CHECK_LINK_B { void *zzq =
+#define CHECK_LINK_E if (!zzq) ast_log(LOG_WARNING,"ao2_link failure! Check this out!");}
+
+ CHECK_LINK_B
ao2_t_link(findcall2, iaxs[x], "moved to new pvt callno in trunk range");
-
+ CHECK_LINK_E
/* Update the two timers that should have been started */
iaxs[x]->pingid = iax2_sched_replace(iaxs[x]->pingid, sched,
ping_time * 1000, send_ping, (void *)(long)x);
@@ -1782,8 +1786,12 @@
ast_string_field_set(iaxs[x], accountcode, accountcode);
ast_string_field_set(iaxs[x], mohinterpret, mohinterpret);
ast_string_field_set(iaxs[x], mohsuggest, mohsuggest);
+ CHECK_LINK_B
ao2_t_link(findcall1, iaxs[x], "a new pvt is borne!");
+ CHECK_LINK_E
+ CHECK_LINK_B
ao2_t_link(findcall2, iaxs[x], "a new pvt is borne!");
+ CHECK_LINK_E
/* it appears that findcall3 and findcall4 will not be linked, as the transferring field is 0 */
} else {
ast_log(LOG_WARNING, "Out of resources\n");
@@ -3858,9 +3866,13 @@
iaxs[callno0]->transferring = mediaonly ? TRANSFER_MBEGIN : TRANSFER_BEGIN;
iaxs[callno1]->transferring = mediaonly ? TRANSFER_MBEGIN : TRANSFER_BEGIN;
if (!old0)
+ CHECK_LINK_B
ao2_t_link(findcall3,iaxs[callno0],"adding to findcall3 (callno0) because transfer is beginning");
+ CHECK_LINK_E
if (!old1)
+ CHECK_LINK_B
ao2_t_link(findcall3,iaxs[callno1],"adding to findcall3 (callno1) because transfer is beginning");
+ CHECK_LINK_E
if (old0 == TRANSFER_MEDIAPASS) /* seems improbable, but I'd better be complete for the moment... */
ao2_t_unlink(findcall4,iaxs[callno0],"removing from findcall4 (callno0) because transfer is beginning, but was in MEDIAPASS");
if (old1 == TRANSFER_MEDIAPASS)
@@ -6443,7 +6455,9 @@
pvt->transfer.sin_family = AF_INET;
pvt->transferring = TRANSFER_BEGIN;
if (!old1)
+ CHECK_LINK_B
ao2_t_link(findcall3,pvt,"adding this entry to findcall3, because transferring was previously 0");
+ CHECK_LINK_E
pvt->transferid = ies->transferid;
if (ies->transferid)
@@ -6542,8 +6556,12 @@
pvt->lastsent = 0;
pvt->nextpred = 0;
pvt->pingtime = DEFAULT_RETRY_TIME;
+ CHECK_LINK_B
ao2_t_link(findcall1, pvt, "Adding pvt back to findcall1, we changed addr/peercallno");
+ CHECK_LINK_E
+ CHECK_LINK_B
ao2_t_link(findcall2, pvt, "Removing pvt from findcall2, we changed addr");
+ CHECK_LINK_E
AST_LIST_LOCK(&frame_queue);
AST_LIST_TRAVERSE(&frame_queue, cur, list) {
@@ -7990,7 +8008,9 @@
if (iaxs[fr->callno]->peercallno)
ao2_t_unlink(findcall1,iaxs[fr->callno],"remove pvt from findcall1, we are changing the peercallno field");
iaxs[fr->callno]->peercallno = (unsigned short)(ntohs(mh->callno) & ~IAX_FLAG_FULL);
+ CHECK_LINK_B
ao2_t_link(findcall1,iaxs[fr->callno],"replace pvt in findcall1, we are changing the peercallno field");
+ CHECK_LINK_E
}
if (ntohs(mh->callno) & IAX_FLAG_FULL) {
if (iaxdebug)
@@ -8336,7 +8356,9 @@
send_command(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_TXREADY, 0, ied1.buf, ied1.pos, -1);
iaxs[fr->callno]->transferring = TRANSFER_READY;
if (!old1)
+ CHECK_LINK_B
ao2_t_link(findcall3, iaxs[fr->callno], "pvt set transferring; add to findcall3");
+ CHECK_LINK_E
}
break;
case IAX_COMMAND_NEW:
@@ -9162,7 +9184,9 @@
iaxs[fr->callno]->transferring = TRANSFER_MEDIA;
if (!old2)
+ CHECK_LINK_B
ao2_t_link(findcall3, iaxs[iaxs[fr->callno]->bridgecallno], "transferring now set; adding to findcall3.");
+ CHECK_LINK_E
memset(&ied0, 0, sizeof(ied0));
memset(&ied1, 0, sizeof(ied1));
@@ -9186,7 +9210,9 @@
ast_set_flag(iaxs[iaxs[fr->callno]->bridgecallno], IAX_ALREADYGONE);
ast_set_flag(iaxs[fr->callno], IAX_ALREADYGONE);
if (!oldbdg)
+ CHECK_LINK_B
ao2_t_link(findcall3,iaxs[iaxs[fr->callno]->bridgecallno],"changing from !transferring TRANSFER_RELEASED");
+ CHECK_LINK_E
if (!oldfr)
ao2_t_unlink(findcall3,iaxs[fr->callno],"changing from transferring MEDIAPASS to TRANSFER_RELEASED");
@@ -9229,7 +9255,9 @@
AST_LIST_UNLOCK(&frame_queue);
/* Start sending our media to the transfer address, but otherwise leave the call as-is */
iaxs[fr->callno]->transferring = TRANSFER_MEDIAPASS;
+ CHECK_LINK_B
ao2_t_link(findcall4, iaxs[fr->callno], "This pvt is being set in MEDIAPASS state, adding to findcall4");
+ CHECK_LINK_E
/* should already be in findcall3 */
}
break;
More information about the asterisk-commits
mailing list