[asterisk-commits] irroot: branch irroot/distrotech-customers-trunk r319010 - /team/irroot/distr...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat May 14 14:47:37 CDT 2011


Author: irroot
Date: Sat May 14 14:47:32 2011
New Revision: 319010

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=319010
Log:
Some deadlock avoidance added as deadlocks are discovered
Set the context if not set in mailbox.


Modified:
    team/irroot/distrotech-customers-trunk/channels/chan_sip.c

Modified: team/irroot/distrotech-customers-trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-trunk/channels/chan_sip.c?view=diff&rev=319010&r1=319009&r2=319010
==============================================================================
--- team/irroot/distrotech-customers-trunk/channels/chan_sip.c (original)
+++ team/irroot/distrotech-customers-trunk/channels/chan_sip.c Sat May 14 14:47:32 2011
@@ -6087,7 +6087,10 @@
 	} else
 		ast_debug(1, "Hangup call %s, SIP callid %s\n", ast->name, p->callid);
 
-	sip_pvt_lock(p);
+	while (sip_pvt_trylock(p)) {
+		CHANNEL_DEADLOCK_AVOIDANCE(ast);
+	}
+
 	if (ast_test_flag(&p->flags[0], SIP_INC_COUNT) || ast_test_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD)) {
 		if (sipdebug)
 			ast_debug(1, "update_call_counter(%s) - decrement call limit counter on hangup\n", p->username);
@@ -6315,7 +6318,9 @@
 			return 0;
 		}
 		if (p) {
-			sip_pvt_lock(p);
+			while (sip_pvt_trylock(p)) {
+				CHANNEL_DEADLOCK_AVOIDANCE(ast);
+			}
 			if (p->rtp) {
 				/* If channel is not up, activate early media session */
 				if ((ast->_state != AST_STATE_UP) &&
@@ -6424,7 +6429,10 @@
 	}
 	p = newchan->tech_pvt;
 
-	sip_pvt_lock(p);
+	while (sip_pvt_trylock(p)) {
+		CHANNEL_DEADLOCK_AVOIDANCE(oldchan);
+	}
+
 	append_history(p, "Masq", "Old channel: %s\n", oldchan->name);
 	append_history(p, "Masq (cont)", "...new owner: %s\n", newchan->name);
 	if (p->owner != oldchan)
@@ -6450,6 +6458,10 @@
 {
 	struct sip_pvt *p = ast->tech_pvt;
 	int res = 0;
+
+	if (!p) {
+		return res;
+	}
 
 	sip_pvt_lock(p);
 	switch (ast_test_flag(&p->flags[0], SIP_DTMF)) {
@@ -7240,7 +7252,10 @@
 	struct sip_pvt *p = ast->tech_pvt;
 	int faxdetected = FALSE;
 
-	sip_pvt_lock(p);
+	while (sip_pvt_trylock(p)) {
+		CHANNEL_DEADLOCK_AVOIDANCE(ast);
+	}
+
 	fr = sip_rtp_read(ast, p, &faxdetected);
 	p->lastrtprx = time(NULL);
 
@@ -26411,6 +26426,11 @@
 	while ((mbox = context = strsep(&next, ","))) {
 		struct sip_mailbox *mailbox;
 		int duplicate = 0;
+
+		if (strstr("@",context) == NULL) {
+			strncat(context,"@",sizeof(context)-2);
+			strncat(context,peer->context,sizeof(context)-strlen(peer->context)-1);
+		}
 
 		strsep(&context, "@");
 
@@ -28297,7 +28317,10 @@
 		return AST_RTP_GLUE_RESULT_FORBID;
 	}
 
-	sip_pvt_lock(p);
+	while (sip_pvt_trylock(p)) {
+		CHANNEL_DEADLOCK_AVOIDANCE(chan);
+	}
+
 	if (!(p->rtp)) {
 		sip_pvt_unlock(p);
 		return AST_RTP_GLUE_RESULT_FORBID;




More information about the asterisk-commits mailing list