[Asterisk-cvs] asterisk/channels chan_mgcp.c,1.90,1.91

markster at lists.digium.com markster at lists.digium.com
Sun Nov 14 12:22:18 CST 2004


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv2773/channels

Modified Files:
	chan_mgcp.c 
Log Message:
Fix MGCP deadlock potential


Index: chan_mgcp.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_mgcp.c,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -d -r1.90 -r1.91
--- chan_mgcp.c	7 Nov 2004 21:46:09 -0000	1.90
+++ chan_mgcp.c	14 Nov 2004 17:23:06 -0000	1.91
@@ -887,7 +887,6 @@
 
 		transmit_notify_request_with_callerid(sub, tone, ast->cid.cid_num, ast->cid.cid_name);
 		ast_setstate(ast, AST_STATE_RINGING);
-		mgcp_queue_control(sub, AST_CONTROL_RINGING);
 
         if (sub->next->owner && strlen(sub->next->cxident) && strlen(sub->next->callid)) {
             /* Put the connection back in sendrecv */
@@ -900,6 +899,7 @@
 		res = -1;
 	}
 	ast_mutex_unlock(&sub->lock);
+	ast_queue_frame(ast, AST_CONTROL_RINGING);
 	return res;
 }
 
@@ -2327,20 +2327,20 @@
             if (sub->owner) {
                 ast_log(LOG_NOTICE, "Terminating on result %d from %s@%s-%d\n", 
                         result, p->name, p->parent->name, sub ? sub->id:-1);
-                ast_softhangup(sub->owner, AST_SOFTHANGUP_DEV);
+                mgcp_queue_hangup(sub);
             }
         }
         else {
             if (p->sub->next->owner) {
                 ast_log(LOG_NOTICE, "Terminating on result %d from %s@%s-%d\n", 
                         result, p->name, p->parent->name, sub ? sub->id:-1);
-                ast_softhangup(p->sub->next->owner, AST_SOFTHANGUP_DEV);
+                mgcp_queue_hangup(sub);
             }
 
             if (p->sub->owner) {
                 ast_log(LOG_NOTICE, "Terminating on result %d from %s@%s-%d\n", 
                         result, p->name, p->parent->name, sub ? sub->id:-1);
-                ast_softhangup(p->sub->owner, AST_SOFTHANGUP_DEV);
+                mgcp_queue_hangup(sub);
             }
 
             dump_cmd_queues(p, NULL);
@@ -2406,7 +2406,7 @@
                             /* SC: XXX cleanup if we think we are offhook XXX */
                             if ((p->sub->owner || p->sub->next->owner ) && 
                                 p->hookstate == MGCP_OFFHOOK)
-                                ast_softhangup(sub->owner, AST_SOFTHANGUP_DEV);
+				                mgcp_queue_hangup(sub);
                             p->hookstate = MGCP_ONHOOK;
 
                             /* SC: update the requested events according to the new hookstate */
@@ -2935,8 +2935,7 @@
 						first_sub = tmp_ep->sub;
 						tmp_sub = tmp_ep->sub;
 						while (tmp_sub) {
-							if (tmp_sub->owner)
-								ast_softhangup(tmp_sub->owner, AST_SOFTHANGUP_DEV);
+			                mgcp_queue_hangup(tmp_sub);
 							tmp_sub = tmp_sub->next;
 							if (tmp_sub == first_sub)
 								break;
@@ -2945,7 +2944,7 @@
 					tmp_ep = tmp_ep->next;
 				}
 			} else if (sub->owner) {
-				ast_softhangup(sub->owner, AST_SOFTHANGUP_DEV);
+                mgcp_queue_hangup(sub);
 			}
 			transmit_response(sub, "200", req, "OK");
 			/* JS: We dont send NTFY or AUEP to wildcard ep */
@@ -3909,9 +3908,7 @@
             sub->rtp = NULL;
         }
         memset(sub->magic, 0, sizeof(sub->magic));
-        if (sub->owner) {
-            ast_softhangup(sub->owner, AST_SOFTHANGUP_DEV);
-        }
+        mgcp_queue_hangup(sub);
         dump_cmd_queues(NULL, sub);
         ast_mutex_unlock(&sub->lock);
         sub = sub->next;
@@ -4234,8 +4231,7 @@
 		/* Hangup all interfaces if they have an owner */
 		p = iflist;
 		while(p) {
-			if (p->owner)
-				ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD);
+            mgcp_queue_hangup(p);
 			p = p->next;
 		}
 		iflist = NULL;




More information about the svn-commits mailing list