[Asterisk-cvs] asterisk/res res_monitor.c,1.9,1.10 res_parking.c,1.22,1.23

markster at lists.digium.com markster at lists.digium.com
Thu May 20 12:17:25 CDT 2004


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

Modified Files:
	res_monitor.c res_parking.c 
Log Message:
Make ast_channel_walk become ast_channel_walk_locked


Index: res_monitor.c
===================================================================
RCS file: /usr/cvsroot/asterisk/res/res_monitor.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- res_monitor.c	6 Feb 2004 05:52:03 -0000	1.9
+++ res_monitor.c	20 May 2004 16:30:10 -0000	1.10
@@ -333,12 +333,13 @@
 		astman_send_error(s, m, "No channel specified");
 		return 0;
 	}
-	c = ast_channel_walk(NULL);
+	c = ast_channel_walk_locked(NULL);
 	while(c) {
 		if (!strcasecmp(c->name, name)) {
 			break;
 		}
-		c = ast_channel_walk(c);
+		ast_mutex_unlock(&c->lock);
+		c = ast_channel_walk_locked(c);
 	}
 	if (!c) {
 		astman_send_error(s, m, "No such channel");
@@ -360,6 +361,7 @@
 			return 0;
 		}
 	}
+	ast_mutex_unlock(&c->lock);
 	astman_send_ack(s, m, "Started monitoring channel");
 	return 0;
 }
@@ -368,22 +370,26 @@
 {
 	struct ast_channel *c = NULL;
 	char *name = astman_get_header(m, "Channel");
+	int res;
 	if((!name)||(!strlen(name))) {
 		astman_send_error(s, m, "No channel specified");
 		return 0;
 	}
-	c = ast_channel_walk(NULL);
+	c = ast_channel_walk_locked(NULL);
 	while(c) {
 		if (!strcasecmp(c->name, name)) {
 			break;
 		}
-		c = ast_channel_walk(c);
+		ast_mutex_unlock(&c->lock);
+		c = ast_channel_walk_locked(c);
 	}
 	if (!c) {
 		astman_send_error(s, m, "No such channel");
 		return 0;
 	}
-	if( ast_monitor_stop( c, 1 ) ) {
+	res = ast_monitor_stop( c, 1 );
+	ast_mutex_unlock(&c->lock);
+	if( res ) {
 		astman_send_error(s, m, "Could not stop monitoring channel");
 		return 0;
 	}
@@ -404,12 +410,13 @@
 		astman_send_error(s, m, "No filename specified");
 		return 0;
 	}
-	c = ast_channel_walk(NULL);
+	c = ast_channel_walk_locked(NULL);
 	while(c) {
 		if (!strcasecmp(c->name, name)) {
 			break;
 		}
-		c = ast_channel_walk(c);
+		ast_mutex_unlock(&c->lock);
+		c = ast_channel_walk_locked(c);
 	}
 	if (!c) {
 		astman_send_error(s, m, "No such channel");

Index: res_parking.c
===================================================================
RCS file: /usr/cvsroot/asterisk/res/res_parking.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- res_parking.c	27 Apr 2004 21:21:57 -0000	1.22
+++ res_parking.c	20 May 2004 16:30:10 -0000	1.23
@@ -737,7 +737,7 @@
 {
 	struct ast_channel *cur;
 	int res = -1;
-	cur = ast_channel_walk(NULL);
+	cur = ast_channel_walk_locked(NULL);
 	while(cur) {
 		if (!cur->pbx && 
 			(cur != chan) &&
@@ -746,7 +746,8 @@
 			 (cur->_state == AST_STATE_RING))) {
 			 	break;
 		}
-		cur = ast_channel_walk(cur);
+		ast_mutex_unlock(&cur->lock);
+		cur = ast_channel_walk_locked(cur);
 	}
 	if (cur) {
 		ast_log(LOG_DEBUG, "Call pickup on chan '%s' by '%s'\n",cur->name, chan->name);
@@ -759,6 +760,7 @@
 		res = ast_channel_masquerade(cur, chan);
 		if (res)
 			ast_log(LOG_WARNING, "Unable to masquerade '%s' into '%s'\n", chan->name, cur->name);		/* Done */
+		ast_mutex_unlock(&cur->lock);
 	} else	{
 		ast_log(LOG_DEBUG, "No call pickup possible...\n");
 	}




More information about the svn-commits mailing list