[Asterisk-cvs] asterisk/channels chan_zap.c,1.336,1.337

markster at lists.digium.com markster at lists.digium.com
Fri Sep 10 14:56:06 CDT 2004


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

Modified Files:
	chan_zap.c 
Log Message:
Do the same thing for pri_hangup_all in terms of releasing the PRI lock


Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.336
retrieving revision 1.337
diff -u -d -r1.336 -r1.337
--- chan_zap.c	10 Sep 2004 18:47:13 -0000	1.336
+++ chan_zap.c	10 Sep 2004 18:58:05 -0000	1.337
@@ -6874,10 +6874,11 @@
 	return 0;
 }
 
-static int pri_hangup_all(struct zt_pvt *p)
+static int pri_hangup_all(struct zt_pvt *p, struct zt_pri *pri)
 {
 	int x;
 	int redo;
+	ast_mutex_unlock(&pri->lock);
 	ast_mutex_lock(&p->lock);
 	do {
 		redo = 0;
@@ -6895,6 +6896,7 @@
 		}
 	} while (redo);
 	ast_mutex_unlock(&p->lock);
+	ast_mutex_lock(&pri->lock);
 	return 0;
 }
 
@@ -7160,7 +7162,7 @@
 									ast_log(LOG_WARNING, "The PRI Call have not been destroyed\n");
 							}
 							if (p->master) {
-								pri_hangup_all(p->master);
+								pri_hangup_all(p->master, pri);
 							} else if (p->owner)
 								p->owner->_softhangup |= AST_SOFTHANGUP_DEV;
 							p->inalarm = 1;
@@ -7185,7 +7187,7 @@
 						}
 						/* Force soft hangup if appropriate */
 						if (pri->pvts[chanpos]->master) 
-							pri_hangup_all(pri->pvts[chanpos]->master);
+							pri_hangup_all(pri->pvts[chanpos]->master, pri);
 						else if (pri->pvts[chanpos]->owner)
 							pri->pvts[chanpos]->owner->_softhangup |= AST_SOFTHANGUP_DEV;
 						ast_mutex_unlock(&pri->pvts[chanpos]->lock);
@@ -7201,7 +7203,7 @@
 								pri->pvts[x]->call = NULL;
 							}
 							if (pri->pvts[chanpos]->master) 
-								pri_hangup_all(pri->pvts[chanpos]->master);
+								pri_hangup_all(pri->pvts[chanpos]->master, pri);
  							else if (pri->pvts[x]->owner)
 								pri->pvts[x]->owner->_softhangup |= AST_SOFTHANGUP_DEV;
 							ast_mutex_unlock(&pri->pvts[x]->lock);
@@ -7256,7 +7258,7 @@
 							ast_log(LOG_WARNING, "Ring requested on channel %d/%d already in use on span %d.  Hanging up owner.\n", 
 							PRI_SPAN(e->ring.channel), PRI_CHANNEL(e->ring.channel), pri->span);
 							if (pri->pvts[chanpos]->master) 
-								pri_hangup_all(pri->pvts[chanpos]->master);
+								pri_hangup_all(pri->pvts[chanpos]->master, pri);
 							else
 								pri->pvts[chanpos]->owner->_softhangup |= AST_SOFTHANGUP_DEV;
 							ast_mutex_unlock(&pri->pvts[chanpos]->lock);
@@ -7556,7 +7558,7 @@
 							/* we're calling here zt_hangup so once we get there we need to clear p->call after calling pri_hangup */
 							pri->pvts[chanpos]->alreadyhungup = 1;
 							if (pri->pvts[chanpos]->master) 
-								pri_hangup_all(pri->pvts[chanpos]->master);
+								pri_hangup_all(pri->pvts[chanpos]->master, pri);
 							else if (pri->pvts[chanpos]->owner) {
 								/* Queue a BUSY instead of a hangup if our cause is appropriate */
 								pri->pvts[chanpos]->owner->hangupcause = e->hangup.cause;
@@ -7612,7 +7614,7 @@
 					if (chanpos > -1) {
 						ast_mutex_lock(&pri->pvts[chanpos]->lock);
 						if (pri->pvts[chanpos]->master) 
-							pri_hangup_all(pri->pvts[chanpos]->master);
+							pri_hangup_all(pri->pvts[chanpos]->master, pri);
 						else if (pri->pvts[chanpos]->owner) {
 							pri->pvts[chanpos]->owner->hangupcause = e->hangup.cause;
 							switch(e->hangup.cause) {
@@ -7686,7 +7688,7 @@
 							ast_log(LOG_DEBUG, "Assuming restart ack is really for channel %d/%d span %d\n", pri->pvts[chanpos]->logicalspan, 
 									pri->pvts[chanpos]->prioffset, pri->span);
 							if (pri->pvts[chanpos]->master) 
-								pri_hangup_all(pri->pvts[chanpos]->master);
+								pri_hangup_all(pri->pvts[chanpos]->master, pri);
 							else if (pri->pvts[chanpos]->owner) {
 								ast_log(LOG_WARNING, "Got restart ack on channel %d/%d with owner on span %d\n", pri->pvts[chanpos]->logicalspan, 
 									pri->pvts[chanpos]->prioffset, pri->span);
@@ -7712,7 +7714,7 @@
 					if (pri->pvts[chanpos]) {
 						ast_mutex_lock(&pri->pvts[chanpos]->lock);
 						if (pri->pvts[chanpos]->master) 
-							pri_hangup_all(pri->pvts[chanpos]->master);
+							pri_hangup_all(pri->pvts[chanpos]->master, pri);
 						else if (pri->pvts[chanpos]->owner) {
 							ast_log(LOG_WARNING, "Got restart ack on channel %d/%d span %d with owner\n",
 								PRI_SPAN(e->restartack.channel), PRI_CHANNEL(e->restartack.channel), pri->span);




More information about the svn-commits mailing list