[svn-commits] file: branch file/groupcountv2 r58852 - /team/file/groupcountv2/

svn-commits at lists.digium.com svn-commits at lists.digium.com
Tue Mar 13 09:48:38 MST 2007


Author: file
Date: Tue Mar 13 11:48:36 2007
New Revision: 58852

URL: http://svn.digium.com/view/asterisk?view=rev&rev=58852
Log:
Probably useful to have the group count discarded when the channel disappears.

Modified:
    team/file/groupcountv2/app.c
    team/file/groupcountv2/channel.c

Modified: team/file/groupcountv2/app.c
URL: http://svn.digium.com/view/asterisk/team/file/groupcountv2/app.c?view=diff&rev=58852&r1=58851&r2=58852
==============================================================================
--- team/file/groupcountv2/app.c (original)
+++ team/file/groupcountv2/app.c Tue Mar 13 11:48:36 2007
@@ -1125,6 +1125,18 @@
 
 int ast_app_group_discard(struct ast_channel *chan)
 {
+	struct ast_group_info *gi = NULL;
+
+	AST_LIST_LOCK(&groups);
+	AST_LIST_TRAVERSE_SAFE_BEGIN(&groups, gi, list) {
+		if (gi->chan == chan) {
+			AST_LIST_REMOVE_CURRENT(&groups, list);
+			free(gi);
+		}
+	}
+        AST_LIST_TRAVERSE_SAFE_END
+	AST_LIST_UNLOCK(&groups);
+
 	return 0;
 }
 

Modified: team/file/groupcountv2/channel.c
URL: http://svn.digium.com/view/asterisk/team/file/groupcountv2/channel.c?view=diff&rev=58852&r1=58851&r2=58852
==============================================================================
--- team/file/groupcountv2/channel.c (original)
+++ team/file/groupcountv2/channel.c Tue Mar 13 11:48:36 2007
@@ -953,6 +953,9 @@
 	
 	while ((vardata = AST_LIST_REMOVE_HEAD(headp, entries)))
 		ast_var_delete(vardata);
+
+	/* Drop out of the group counting radar */
+	ast_app_group_discard(chan);
 
 	free(chan);
 	ast_mutex_unlock(&chlock);
@@ -3102,6 +3105,8 @@
 	for (x = 0; x < AST_MAX_FDS; x++) {
 		original->fds[x] = clone->fds[x];
 	}
+	/* Drop group from original */
+	ast_app_group_discard(original);
 	clone_variables(original, clone);
 	AST_LIST_HEAD_INIT_NOLOCK(&clone->varshead);
 	/* Presense of ADSI capable CPE follows clone */



More information about the svn-commits mailing list