[asterisk-commits] file: trunk r43792 - in /trunk: ./ channels/chan_iax2.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Sep 27 10:02:29 MST 2006


Author: file
Date: Wed Sep 27 12:02:28 2006
New Revision: 43792

URL: http://svn.digium.com/view/asterisk?rev=43792&view=rev
Log:
Merged revisions 43783 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r43783 | file | 2006-09-27 13:00:31 -0400 (Wed, 27 Sep 2006) | 2 lines

Get rid of two functions from a time now past (we THINK these are from pre-recursive lock time) that may be contributing to two open issues on the bug tracker (7562/7939) and that has the potential to just make bad things happen if the timing is right.

........

Modified:
    trunk/   (props changed)
    trunk/channels/chan_iax2.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?rev=43792&r1=43791&r2=43792&view=diff
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Wed Sep 27 12:02:28 2006
@@ -1699,15 +1699,6 @@
 	return 0;
 }
 
-static int iax2_predestroy_nolock(int callno)
-{
-	int res;
-	ast_mutex_unlock(&iaxsl[callno]);
-	res = iax2_predestroy(callno);
-	ast_mutex_lock(&iaxsl[callno]);
-	return res;
-}
-
 static void iax2_destroy(int callno)
 {
 	struct chan_iax2_pvt *pvt = NULL;
@@ -1773,13 +1764,6 @@
 	ast_mutex_unlock(&iaxsl[callno]);
 	if (callno & 0x4000)
 		update_max_trunk();
-}
-static void iax2_destroy_nolock(int callno)
-{	
-	/* Actually it's easier to unlock, kill it, and relock */
-	ast_mutex_unlock(&iaxsl[callno]);
-	iax2_destroy(callno);
-	ast_mutex_lock(&iaxsl[callno]);
 }
 
 static int update_packet(struct iax_frame *f)
@@ -1815,7 +1799,7 @@
 						send_command(iaxs[callno], AST_FRAME_IAX, IAX_COMMAND_TXREJ, 0, NULL, 0, -1);
 					} else if (f->final) {
 						if (f->final) 
-							iax2_destroy_nolock(callno);
+							iax2_destroy(callno);
 					} else {
 						if (iaxs[callno]->owner)
 							ast_log(LOG_WARNING, "Max retries exceeded to host %s on %s (type = %d, subclass = %d, ts=%d, seqno=%d)\n", ast_inet_ntoa(iaxs[f->callno]->addr.sin_addr),iaxs[f->callno]->owner->name , f->af.frametype, f->af.subclass, f->ts, f->oseqno);
@@ -1835,7 +1819,7 @@
 								iaxs[callno]->reg->regstate = REG_STATE_TIMEOUT;
 								iaxs[callno]->reg->refresh = IAX_DEFAULT_REG_EXPIRE;
 							}
-							iax2_destroy_nolock(callno);
+							iax2_destroy(callno);
 						}
 					}
 
@@ -2924,11 +2908,11 @@
 		if (!iaxs[callno]->error && !alreadygone) 
  			send_command_final(iaxs[callno], AST_FRAME_IAX, IAX_COMMAND_HANGUP, 0, ied.buf, ied.pos, -1);
 		/* Explicitly predestroy it */
-		iax2_predestroy_nolock(callno);
+		iax2_predestroy(callno);
 		/* If we were already gone to begin with, destroy us now */
 		if (alreadygone) {
 			ast_log(LOG_DEBUG, "Really destroying %s now...\n", c->name);
-			iax2_destroy_nolock(callno);
+			iax2_destroy(callno);
 		}
 	}
 	ast_mutex_unlock(&iaxsl[callno]);
@@ -4523,7 +4507,7 @@
 static int send_command_final(struct chan_iax2_pvt *i, char type, int command, unsigned int ts, const unsigned char *data, int datalen, int seqno)
 {
 	/* It is assumed that the callno has already been locked */
-	iax2_predestroy_nolock(i->callno);
+	iax2_predestroy(i->callno);
 	return __send_command(i, type, command, ts, data, datalen, seqno, 0, 0, 1);
 }
 
@@ -6563,7 +6547,7 @@
 							if (cur->final) { 
 								if (iaxdebug && option_debug)
 									ast_log(LOG_DEBUG, "Really destroying %d, having been acked on final message\n", fr->callno);
-								iax2_destroy_nolock(fr->callno);
+								iax2_destroy(fr->callno);
 							}
 						}
 					}
@@ -6871,7 +6855,7 @@
 												using_prefs);
 								
 								if(!(c = ast_iax2_new(fr->callno, AST_STATE_RING, format)))
-									iax2_destroy_nolock(fr->callno);
+									iax2_destroy(fr->callno);
 							} else {
 								ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_TBD);
 								/* If this is a TBD call, we're ready but now what...  */
@@ -6910,7 +6894,7 @@
 					iaxs[fr->callno]->owner->hangupcause = ies.causecode;
 				/* Send ack immediately, before we destroy */
 				send_command_immediate(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_ACK, fr->ts, NULL, 0,fr->iseqno);
-				iax2_destroy_nolock(fr->callno);
+				iax2_destroy(fr->callno);
 				break;
 			case IAX_COMMAND_REJECT:
 				/* Set hangup cause according to remote */
@@ -6930,7 +6914,7 @@
 						       fr->ts, NULL, 0, fr->iseqno);
 				if (!ast_test_flag(iaxs[fr->callno], IAX_PROVISION))
 					iaxs[fr->callno]->error = EPERM;
-				iax2_destroy_nolock(fr->callno);
+				iax2_destroy(fr->callno);
 				break;
 			case IAX_COMMAND_TRANSFER:
 				if (iaxs[fr->callno]->owner && ast_bridged_channel(iaxs[fr->callno]->owner) && ies.called_number) {
@@ -6960,7 +6944,7 @@
 				if (ast_test_flag(iaxs[fr->callno], IAX_PROVISION)) {
 					/* Send ack immediately, before we destroy */
 					send_command_immediate(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_ACK, fr->ts, NULL, 0,fr->iseqno);
-					iax2_destroy_nolock(fr->callno);
+					iax2_destroy(fr->callno);
 					break;
 				}
 				if (ies.format) {
@@ -7063,7 +7047,7 @@
 					/* and finally send the ack */
 					send_command_immediate(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_ACK, fr->ts, NULL, 0,fr->iseqno);
 					/* And wrap up the qualify call */
-					iax2_destroy_nolock(fr->callno);
+					iax2_destroy(fr->callno);
 					peer->callno = 0;
 					if (option_debug)
 						ast_log(LOG_DEBUG, "Peer %s: got pong, lastms %d, historicms %d, maxms %d\n", peer->name, peer->lastms, peer->historicms, peer->maxms);
@@ -7247,7 +7231,7 @@
 
 							ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_STARTED);
 							if(!(c = ast_iax2_new(fr->callno, AST_STATE_RING, format)))
-								iax2_destroy_nolock(fr->callno);
+								iax2_destroy(fr->callno);
 						} else {
 							ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_TBD);
 							/* If this is a TBD call, we're ready but now what...  */
@@ -7275,14 +7259,14 @@
 						ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_STARTED);
 						send_command(iaxs[fr->callno], AST_FRAME_CONTROL, AST_CONTROL_PROGRESS, 0, NULL, 0, -1);
 						if(!(c = ast_iax2_new(fr->callno, AST_STATE_RING, iaxs[fr->callno]->peerformat)))
-							iax2_destroy_nolock(fr->callno);
+							iax2_destroy(fr->callno);
 					}
 				}
 				break;
 			case IAX_COMMAND_INVAL:
 				iaxs[fr->callno]->error = ENOTCONN;
 				ast_log(LOG_DEBUG, "Immediately destroying %d, having received INVAL\n", fr->callno);
-				iax2_destroy_nolock(fr->callno);
+				iax2_destroy(fr->callno);
 				if (option_debug)
 					ast_log(LOG_DEBUG, "Destroying call %d\n", fr->callno);
 				break;
@@ -7318,7 +7302,7 @@
 					ast_log(LOG_WARNING, "Registration failure\n");
 				/* Send ack immediately, before we destroy */
 				send_command_immediate(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_ACK, fr->ts, NULL, 0,fr->iseqno);
-				iax2_destroy_nolock(fr->callno);
+				iax2_destroy(fr->callno);
 				break;
 			case IAX_COMMAND_REGREJ:
 				if (iaxs[fr->callno]->reg) {
@@ -7330,7 +7314,7 @@
 				}
 				/* Send ack immediately, before we destroy */
 				send_command_immediate(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_ACK, fr->ts, NULL, 0,fr->iseqno);
-				iax2_destroy_nolock(fr->callno);
+				iax2_destroy(fr->callno);
 				break;
 			case IAX_COMMAND_REGAUTH:
 				/* Authentication request */
@@ -8620,7 +8604,7 @@
 			ast_mutex_lock(&iaxsl[regl->callno]);
 			if (iaxs[regl->callno]) {
 				iaxs[regl->callno]->reg = NULL;
-				iax2_destroy_nolock(regl->callno);
+				iax2_destroy(regl->callno);
 			}
 			ast_mutex_unlock(&iaxsl[regl->callno]);
 		}



More information about the asterisk-commits mailing list