[Asterisk-cvs] asterisk/channels chan_mgcp.c,1.100,1.101

markster at lists.digium.com markster at lists.digium.com
Fri Dec 31 20:05:22 CST 2004


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

Modified Files:
	chan_mgcp.c 
Log Message:
Grab lock in hangup earlier


Index: chan_mgcp.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_mgcp.c,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -d -r1.100 -r1.101
--- chan_mgcp.c	28 Dec 2004 16:48:20 -0000	1.100
+++ chan_mgcp.c	1 Jan 2005 00:59:54 -0000	1.101
@@ -914,38 +914,38 @@
 	struct mgcp_subchannel *sub = ast->pvt->pvt;
 	struct mgcp_endpoint *p = sub->parent;
 
-	if (option_debug)
+	if (option_debug) {
 		ast_log(LOG_DEBUG, "mgcp_hangup(%s)\n", ast->name);
+	}
 	if (!ast->pvt->pvt) {
 		ast_log(LOG_DEBUG, "Asked to hangup channel not connected\n");
 		return 0;
 	}
-    if (strcmp(sub->magic, MGCP_SUBCHANNEL_MAGIC)) {
+	if (strcmp(sub->magic, MGCP_SUBCHANNEL_MAGIC)) {
 		ast_log(LOG_DEBUG, "Invalid magic. MGCP subchannel freed up already.\n");
 		return 0;
-    }
-    if (mgcpdebug) {
-        ast_verbose(VERBOSE_PREFIX_3 "MGCP mgcp_hangup(%s) on %s@%s\n", ast->name, p->name, p->parent->name);
-    }
+	}
+	ast_mutex_lock(&sub->lock);
+	if (mgcpdebug) {
+		ast_verbose(VERBOSE_PREFIX_3 "MGCP mgcp_hangup(%s) on %s@%s\n", ast->name, p->name, p->parent->name);
+	}
 
-	if ((p->dtmfmode & MGCP_DTMF_INBAND) && (p->dsp != NULL)){
+	if ((p->dtmfmode & MGCP_DTMF_INBAND) && p->dsp) {
         /* SC: check whether other channel is active. */
-        if (!sub->next->owner)
-        {
+        if (!sub->next->owner) {
             if (mgcpdebug) {
                 ast_verbose(VERBOSE_PREFIX_2 "MGCP free dsp on %s@%s\n", p->name, p->parent->name);
             }
             ast_dsp_free(p->dsp);
             p->dsp = NULL;
         }
-    }
-	ast_mutex_lock(&sub->lock);
+	}
 
 	sub->owner = NULL;
 	if (strlen(sub->cxident)) {
 		transmit_connection_del(sub);
-    }
-	 sub->cxident[0] = '\0';
+	}
+	sub->cxident[0] = '\0';
     if ((sub == p->sub) && sub->next->owner) {
         if (p->hookstate == MGCP_OFFHOOK) {
             if (sub->next->owner && ast_bridged_channel(sub->next->owner)) {




More information about the svn-commits mailing list