[asterisk-commits] alecdavis: trunk r391335 - in /trunk: ./ channels/chan_iax2.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jun 11 03:13:41 CDT 2013
Author: alecdavis
Date: Tue Jun 11 03:13:39 2013
New Revision: 391335
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=391335
Log:
IAX2: Transfer Reject: Lock bridgecallno before touching it, refactor
1). When touching the bridgecallno, we need to lock it.
2). Remove magic number '0' and replace with TRANSFER_NONE.
3). Exit early if no bridgecallno.
4). Reduce indentation.
Reported by: alecdavis
Tested by: alecdavis
alecdavis (license 585)
Review https://reviewboard.asterisk.org/r/2613/
........
Merged revisions 391333 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 391334 from http://svn.asterisk.org/svn/asterisk/branches/11
Modified:
trunk/ (props changed)
trunk/channels/chan_iax2.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.
Modified: trunk/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=391335&r1=391334&r2=391335
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Tue Jun 11 03:13:39 2013
@@ -11204,15 +11204,28 @@
}
break;
case IAX_COMMAND_TXREJ:
- iaxs[fr->callno]->transferring = 0;
+ if (iaxs[fr->callno]->bridgecallno) {
+ while (ast_mutex_trylock(&iaxsl[iaxs[fr->callno]->bridgecallno])) {
+ DEADLOCK_AVOIDANCE(&iaxsl[fr->callno]);
+ }
+ if (!iaxs[fr->callno]) {
+ break;
+ }
+ }
+
+ iaxs[fr->callno]->transferring = TRANSFER_NONE;
ast_verb(3, "Channel '%s' unable to transfer\n", iaxs[fr->callno]->owner ? ast_channel_name(iaxs[fr->callno]->owner) : "<Unknown>");
memset(&iaxs[fr->callno]->transfer, 0, sizeof(iaxs[fr->callno]->transfer));
- if (iaxs[fr->callno]->bridgecallno) {
- if (iaxs[iaxs[fr->callno]->bridgecallno]->transferring) {
- iaxs[iaxs[fr->callno]->bridgecallno]->transferring = 0;
- send_command(iaxs[iaxs[fr->callno]->bridgecallno], AST_FRAME_IAX, IAX_COMMAND_TXREJ, 0, NULL, 0, -1);
- }
+
+ if (!iaxs[fr->callno]->bridgecallno) {
+ break;
}
+
+ if (iaxs[iaxs[fr->callno]->bridgecallno]->transferring) {
+ iaxs[iaxs[fr->callno]->bridgecallno]->transferring = TRANSFER_NONE;
+ send_command(iaxs[iaxs[fr->callno]->bridgecallno], AST_FRAME_IAX, IAX_COMMAND_TXREJ, 0, NULL, 0, -1);
+ }
+ ast_mutex_unlock(&iaxsl[iaxs[fr->callno]->bridgecallno]);
break;
case IAX_COMMAND_TXREADY:
if (iaxs[fr->callno]->bridgecallno) {
More information about the asterisk-commits
mailing list